Repository navigation
fix(jdbi): split example users migrations from core migrations - #186
Merged
Merged
Conversation
Main carries only patch-level dependency bumps since v2.3.0, so the JDBI migration-location fix ships as 2.3.1 rather than waiting for 2.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hosts that excluded V5__example_users.sql failed on 2.3.0's V12__users_username_case_insensitive.sql with `relation "users" does not exist`, because example and library-owned migrations shared one flat location. Migrations now live in db/migration/core (always required) and db/migration/example-users (V5, V12; opt-in for JdbiUserLookup). File names and bytes are unchanged, so checksums still match. Flyway scans recursively, so the documented classpath:db/migration still resolves all twelve and existing hosts need no change. PkAuthJdbiSchema gains the three location constants, CORE_SCHEMA_VERSION (Flyway refuses a target no configured location resolves), and migrateCoreForDevelopment. JdbiMigrationLocationsIntegrationTest covers core-only on an empty database, core plus example, the parent location, and databases migrated under the 2.3.0 flat layout. See ADR 0021. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Hosts with their own identity model that excluded
V5__example_users.sqlfailed on 2.3.0'sV12__users_username_case_insensitive.sqlwithrelation "users" does not exist. Example and library-owned migrations shared one flat location, so there was no clean opt-out.The migrations now ship in two subdirectories sharing one version sequence:
classpath:db/migration/coreclasspath:db/migration/example-usersuserstable)JdbiUserLookupclasspath:db/migrationFile names and bytes are unchanged (sha256-verified), so Flyway checksums still match. V12 is not edited.
This deviates from the sibling-location layout (
db/migration-example-users/) originally proposed. That layout would break hosts that use the example table via the documentedclasspath:db/migration: Flyway validation fails on applied-but-unresolved V5/V12. The nested layout keeps that documented configuration working unchanged, which is what makes this a patch release. ADR 0021 records the options.API additions (
PkAuthJdbiSchema,@since 2.3.1)MIGRATION_LOCATION,CORE_MIGRATION_LOCATION,EXAMPLE_USERS_MIGRATION_LOCATIONCORE_SCHEMA_VERSION("11"): Flyway refuses atargetthat no configured location resolves, so core-only hosts cannot targetCURRENT_SCHEMA_VERSION("12").migrateCoreForDevelopment(DataSource)Host upgrade impact
classpath:db/migration(with or without the example table): no change.db/migration/V*.sqltodb/migration/core/V*.sqland drop the exclusion. The old pattern matches nothing and fails validation loudly. That pattern relied on the jar's internal resource layout, which was never documented.classpath:db/migration/core, targetCORE_SCHEMA_VERSION.Full notes are in
CHANGELOG.mdanddocs/operator-guide.md.Tests
JdbiMigrationLocationsIntegrationTest(Testcontainers Postgres):userstable (regression test)usersandusers_username_lower_keyCORE_SCHEMA_VERSIONmatches the highest core migration on diskRecursive scanning was also checked against the packaged jar (12 / 10 / 2 migrations resolved).
./gradlew check --rerun-tasks: 715 tests, 0 failures. Without--rerun-tasks, Spotless hit the knownNoClassDefFoundErrorclassloader issue on unchanged modules; a cleanmainworktree passed, so it is stale task state, not formatting. Playwright e2e suites were not run.Release
Also retargets
gradle.propertiesto2.3.1-SNAPSHOT. Since v2.3.0, main carries only patch-level dependency bumps.🤖 Generated with Claude Code