feat(adapters): implement baseline on Flyway + Alembic adapters#166
Open
antonyprasad-db wants to merge 1 commit into
Open
feat(adapters): implement baseline on Flyway + Alembic adapters#166antonyprasad-db wants to merge 1 commit into
antonyprasad-db wants to merge 1 commit into
Conversation
The SchemaMigrationAdapter contract (ADR-0005) declares an optional baseline() capability, but every built-in adapter omitted it. Implement it on both: - FlywayAdapter.baseline wraps a new baselineFlyway runner (flyway baseline -baselineVersion=<v> [-baselineDescription=<d>]). - AlembicAdapter.baseline wraps a new stampAlembic runner (alembic stamp <rev>), Alembic's equivalent operation; the contract's version field carries the target revision. Both stamp an already-populated schema at a version so pre-baseline migrations are treated as applied and never re-run - the adoption path for a database whose schema predates the migration tool. Additive and backward-compatible: callers property-check adapter.baseline before invoking, so nothing that treated it as absent breaks. Runner behavior for apply/status/rollback is unchanged. Contract tests updated (static surface now asserts baseline is present); live apply/baseline behavior remains covered by the env-gated integration suites. Co-authored-by: Isaac
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.
What
Implements the optional
baseline()capability on the Flyway and Alembic adapters. TheSchemaMigrationAdaptercontract (ADR-0005) has always declaredbaseline?(), but every built-in adapter omitted it (flagged as a deferred follow-up slice in both adapter files).FlywayAdapter.baseline→ newbaselineFlywayrunner (flyway baseline -baselineVersion=<v> [-baselineDescription=<d>]).AlembicAdapter.baseline→ newstampAlembicrunner (alembic stamp <rev>), Alembic's equivalent operation. The contract'sversionfield carries the target revision.Both stamp an already-populated schema at a version so pre-baseline migrations are treated as applied and never re-run — the adoption path for a database whose schema predates the migration tool.
Why
Closes the two
// baseline intentionally absent … deferred to a follow-upTODOs. Additive and backward-compatible: callers property-checkadapter.baselinebefore invoking, so anything treating it as absent is unaffected.apply/status/rollbackrunner behavior is unchanged.Testing
npm test): ✅ 2408 passed, 0 failed. Updated the Flyway + Alembic adapter contract tests (static surface now assertsbaselineis present).npm run typecheck: ✅ clean.baseline/stampbehavior is not exercised by an automated run here; the change mirrors the existingapply/statusrunner+adapter pattern (same DSN seam, same error shape). Flagging per CONTRIBUTING so a reviewer with workspace access can green Tier 3, or advise if you'd like a live-integration assertion added forbaseline.Notes
dist/(shipped separately inbuild:/release:commits).