Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-2784

Invalid migration export for empty database [GHI#32535]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • RHBK-2757 - Release Red Hat Build of KeyCloak

      Before reporting an issue

      [X] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      core

      Describe the bug

      Using the Setting JPA provider configuration option for migrationStrategy docs, generated a migration export with an empty database. The resulting SQL script contained duplicate CREATE TABLE statements for databasechangelog tables.

      I removed the duplicate statement and used it to create a schema. Afterwards, started up keycloak with migrationStrategy set to validate. The database user, for keycloak, didn't have any DDL privileges. At startup, it tried to create databasechangeloglock tables, for which there wasn't a CREATE TABLE statement in the migration export. Keycloak failed to started due to the lack of DDL privileges.

      Database: PostgreSQL 14
      KC_DB_SCHEMA set to a non-public schema.

      Looking at this part of migration export, https://github.com/keycloak/keycloak/blob/8ce8a4ba089eef25a0e01f58e09890399477b9ef/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/LiquibaseJpaUpdaterProvider.java#L214 , shouldn't it create loglock table instead of log table?

      Version

      25.0.4

      Regression

      [ ] The issue is a regression

      Expected behavior

      The migration export should have CREATE TABLE statement for databasechangeloglock table.

      Actual behavior

      The migration export contains duplicate CREATE TABLE statement for databasechangelog table.

      How to Reproduce?

      Follow the steps mentioned under description.

      Anything else?

      No

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Cloud Native
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: