Skip to content

refactor(db): Drop legacy adoption flow - #25

Open
moshloop wants to merge 5 commits into
mainfrom
refactor/drop-legacy-adoption-flow
Open

moshloop wants to merge 5 commits into
mainfrom
refactor/drop-legacy-adoption-flow

Conversation

@moshloop

Copy link
Copy Markdown
Member

What

  • Remove the legacy adoption flow from the migrate scripts, including sqlserver/adopt.go and its integration test
  • Rerun legacy rows with unrecorded inputs
  • Update docs/guide/cli.md

Notes

  • Changes span database/migrate/scripts (model, plan, scripts tests) and the SQL Server package (apply, barrier, execute, session)

… propagation

Replace the hash-gated apply flow with a self-contained SQL Server plan file. Plan observes the target once and writes every action; Apply verifies the file's integrity and re-plans before running, refusing it as stale when the target moved. Script effects are derived from T-SQL analysis so upstream writers propagate to dependent scripts, and module catalog reads are batched per dependency level instead of per script.

BREAKING CHANGE: migrate apply no longer takes --hash or --artifact; pass the plan file as the argument. backend.Open, Session, Inspect, Preview and ContinuationError are removed in favor of Plan and Apply. The file's hash guards integrity only, not approval of the target state.

The plan file records observed inputs, so a stale plan fails before any script runs rather than being silently re-selected.
Migrations now take a plan file as their only input. migrate plan writes .sqlglot-go/plan.json (or --out) and prints a summary to stderr; migrate apply and review read that file. The --hash, --artifact flags are removed, so apply no longer requires a reviewed hash. The plan file's own hash only guards integrity, and apply refuses a stale plan when the target changed since planning.

Positional source paths let plan detect SQL and HCL by content. Web UI, docs and tests are updated to match. BREAKING CHANGE: --hash and --artifact are removed from migrate apply/review; pass the plan file positionally instead. The HTTP apply endpoint rejects the hash field.
Plan reads the newest ledger row per path across the scope and the absorbed scopes, and apply merges them into the target scope in one transaction. Plan files move to version 2 with an absorbed list; version 1 files are refused and must be regenerated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant