From 8472f78e72a6b7d629d1cc88602aed45f56d7391 Mon Sep 17 00:00:00 2001 From: Ali Tugrul Pinar Date: Wed, 23 Sep 2026 12:25:57 +0300 Subject: [PATCH] Create the lock table in the manual migration export for an empty database The generated script creates the DATABASECHANGELOG table but not DATABASECHANGELOGLOCK, which the server creates itself on startup. That was a deliberate choice when the changelog table DDL was first added, on the grounds that the lock table is always created before the update runs, so emitting it would duplicate. That holds while the script is applied to the database it was generated from. It does not hold for the flow a database user without DDL privileges is left with: generate the script against one database, hand it to an administrator to apply to an empty one. The target then ends up without the lock table and the first startup still has to create it, which that user is not allowed to do. Emit it under the same rule as the changelog table, only when it did not exist before this server started, and only once, with the master changelog. A database populated purely by the generated script can then be started under a user with no DDL privileges at all. Closes #53088 Signed-off-by: Ali Tugrul Pinar --- .../upgrading/topics/migrate_db.adoc | 17 ++++---- .../LiquibaseJpaUpdaterProvider.java | 28 +++++++++++-- .../liquibase/QuarkusJpaUpdaterProvider.java | 28 +++++++++++-- ...ManualMigrationCustomProviderDistTest.java | 8 ++++ .../ManualMigrationEmptyDatabaseDistTest.java | 40 +++++++++++++++++++ .../storage/database/BasicDatabaseTest.java | 5 +++ 6 files changed, 111 insertions(+), 15 deletions(-) diff --git a/docs/documentation/upgrading/topics/migrate_db.adoc b/docs/documentation/upgrading/topics/migrate_db.adoc index c1d8f4b97c5..ca19cd2475a 100644 --- a/docs/documentation/upgrading/topics/migrate_db.adoc +++ b/docs/documentation/upgrading/topics/migrate_db.adoc @@ -71,15 +71,14 @@ kc.[sh|bat] start --spi-connections-jpa--quarkus--migration-export=/