question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR: relation "migration_model" does not exist

See original GitHub issue

Describe the bug

I’m not 100% sure if this is a bug or a missing configuration from my side. I can’t get the latest Docker image quay.io/keycloak/keycloak:17.0.0 up and running. The start always fails with the follwoing log messages:

2022-02-15 19:54:42,453 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (main) SQL Error: 0, SQLState: 42P01
2022-02-15 19:54:42,453 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (main) ERROR: relation "migration_model" does not exist
  Position: 121
2022-02-15 19:54:42,500 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2022-02-15 19:54:42,555 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2022-02-15 19:54:42,555 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
2022-02-15 19:54:42,555 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: could not extract ResultSet
2022-02-15 19:54:42,556 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: ERROR: relation "migration_model" does not exist
  Position: 121

Anyone experiencing the same issue? The configuration was working with the jboss/keycloak:16.1.0 image. I also tried to delete and re-create an empty database schema. But no luck either.

Version

17.0.0

Expected behavior

successfull start.

Actual behavior

ERROR: ERROR: relation "migration_model" does not exist

How to Reproduce?

# docker-compose.yml
version: "3.6"
services:
  ## Keycloak IAM Authentication Provider
  authentication-provider:
    image: quay.io/keycloak/keycloak:17.0.0
    command: "start --auto-build"
    ports:
      - "9001:8080"
    restart: unless-stopped
    environment:
      ## Host settings
      KC_HOSTNAME: keycloak
      ## Database settings
      KC_DB: postgres
      KC_DB_URL: jdbc:postgresql://${PG_HOST}:${PG_PORT}/${PG_DB}
      KC_DB_SCHEMA: ${KEYCLOAK_SCHEMA}
      KC_DB_USERNAME: ${PG_USER}
      KC_DB_PASSWORD: ${PG_PASSWORD}
      ## Admin User settings
      KEYCLOAK_USER: ${KEYCLOAK_USER}
      KEYCLOAK_PASSWORD: ${KEYCLOAK_PASSWORD}
      ## Proxy settings
      KC_PROXY: edge

### Anything else?

_No response_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
fraiguanacommented, Mar 11, 2022

Same issue for me but only when i try to connect to postgresql on Azure , locally works fine. I Resolved it (workaround) by specifying schema name inside KC_DB_SCHEMA and also in KC_DB_URL

ENV KC_DB_URL=jdbc:postgresql://[db_addr]:[db_port]/[db_name]?currentSchema=[db_schema]

2reactions
RossComputerGuycommented, Aug 23, 2022

The issue miraculously disappeared.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django migration relation does not exist - Stack Overflow
I had this problem and I had to comment out everything in urls.py that referenced views.py, then run makemigrations. Hope this helps.
Read more >
ERROR: relation "users" does not exist on Heroku-ruby-on-rails
I run heroku run rake db:migrate but I got error PG::UndefinedColumn: ERROR: column "user_id" of relation "tasks" does not exist · Getting Error...
Read more >
Migrations | Sequelize
A Migration in Sequelize is a javascript file which exports two functions, ... Note: If your database doesn't exist yet, you can just...
Read more >
Postgres : Relation does not exist error - DBA Stack Exchange
But when I try to fire a select * query, it gave me this error: dump=> select * from Approvals; ERROR: relation "approvals"...
Read more >
Keycloak 18 migration_model error during intialization #10743
Name and Version bitnami/keycloak 9.2.7 What steps will reproduce the bug? ... GMT [180] ERROR: relation "migration_model" does not exist at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found