feature/issue 37 okapi table prefix#39
Open
pdudzinsky wants to merge 3 commits intomainfrom
Open
Conversation
Configures okapiPostgresLiquibase / okapiMysqlLiquibase to track their changesets in dedicated `okapi_databasechangelog` / `okapi_databasechangeloglock` tables instead of sharing the host application's defaults. Resetting application migration history no longer affects okapi's tracked state, and uninstalling the library leaves no orphaned changelog entries. Adds a nested `OkapiProperties.Liquibase` block exposing both table names as `okapi.liquibase.changelog-table` / `okapi.liquibase.changelog-lock-table` so applications that prefer the shared layout can opt back in. Validation rejects blank values at startup. Coverage: LiquibaseAutoConfigurationTest (bean wiring, blank validation, Spring Binder contract) plus LiquibaseE2ETest (Postgres + MySQL testcontainers verifying the actual DDL). BREAKING CHANGE: Liquibase tracking-table defaults change from `databasechangelog` / `databasechangeloglock` to `okapi_databasechangelog` / `okapi_databasechangeloglock`. Existing 0.2.x deployments must either opt out via `okapi.liquibase.changelog-table` / `changelog-lock-table`, or migrate okapi's rows into the new tables before first 0.3.0 startup. See README "Database migrations § Upgrading from 0.2.x". Refs #37
Renames the okapi domain table from `outbox` to `okapi_outbox` so host applications with a pre-existing `outbox` table stay untouched. Indexes follow (`idx_okapi_outbox_*`); store SQL and Liquibase changesets stay in lockstep. Migration path: README "Upgrading from 0.2.x". Also: CHANGELOG.md (Keep a Changelog), KDoc on the autoconfigured Liquibase beans, and a Spring binding-validation test pinning that init-block validation propagates through `okapi.liquibase.*`.
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
outbox→okapi_outbox. Indexes follow (idx_okapi_outbox_*). Host applications with a pre-existingoutboxtable are unaffected — okapi creates its own under theokapi_prefix.okapi_databasechangelog/okapi_databasechangeloglock, configurable via two new properties.okapi.liquibase.changelog-table/okapi.liquibase.changelog-lock-table(override the new defaults to keep the shared layout). The domain-table name is fixed.Closes #37.
Motivation
okapi's autoconfiguredSpringLiquibasepreviously inherited Liquibase's defaults and wrote its migration history into the host application'sdatabasechangelog/databasechangeloglock, mixing library and application records. The domain tableoutboxlikewise collided with applications that already have a table by that name. Issue #37 proposed isolating both under anokapi_prefix.What changed
outboxokapi_outbox(fixed)idx_outbox_*idx_okapi_outbox_*databasechangelogokapi_databasechangelog(configurable)databasechangeloglockokapi_databasechangeloglock(configurable)Configuration:
Validation rejects blank values at startup. Domain-table name is hardcoded in
PostgresOutboxStore/MysqlOutboxStoreSQL — no runtime configurability for it.Migration from 0.2.x
Existing 0.2.x deployments must take action before the first 0.3.0 startup. Two paths documented in README — Upgrading from 0.2.x:
Stay on legacy Liquibase changelog tables (zero-downtime opt-out for the tracking pair):
The domain-table rename has no opt-out — run the SQL below regardless.
Rename in place (PostgreSQL syntax shown):
Without one of these steps, Liquibase will see an empty changelog table on the first 0.3.0 startup and try to re-run okapi's migrations — which fails because the legacy
outboxalready exists while okapi now writes tookapi_outbox.CHANGELOG.md (Keep a Changelog 1.1.0) added; covers
[Unreleased]plus retrofits[0.2.0]and[0.1.0].Test plan
LiquibaseAutoConfigurationTest(10 tests): bean wiring (Postgres + MySQL × default + custom), validation rejection (empty/whitespace × table + lock-table),okapi.liquibase.*SpringBindercontract,init-block validation propagation through Spring binding.LiquibaseE2ETest(4 tests): real PostgreSQL 16 + MySQL 8.0 containers verify autoconfig createsokapi_outbox+okapi_databasechangelog+okapi_databasechangeloglockon startup; customokapi.liquibase.changelog-tableactually creates the named table in DDL.*ConnectionLeakProofTest,MultiDataSourceTransactionTest,*ConcurrentClaimTest,*EndToEndTest, store contract tests adapted tookapi_outbox— all green../gradlew build(105 tasks) green;./gradlew ktlintCheckclean.