The embedded Dolt backend open path ran only the embedded SQL
migrations via schema.MigrateUp. The defensive backward-compat
migration runner was invoked only from the server-mode path in
dolt.initSchemaOnDB. Pre-existing embedded databases opened by a
newer bd binary therefore skipped every compat migration 001-017,
leaving missing columns and tables unrepaired.
The runner itself has no coupling to package dolt -- it drives
idempotent migration functions that already live in the migrations/
subpackage. Relocating CompatMigration, compatMigrationsList,
RunCompatMigrations, and ListCompatMigrations into package migrations
puts them alongside the functions they drive, and lets both the
server and embedded backends share them without a cross-backend
import.
Changes:
- New internal/storage/dolt/migrations/runner.go with the runner,
registry list, and the exported List function.
- internal/storage/dolt/migrations.go trimmed to CreateIgnoredTables.
- internal/storage/dolt/store.go and cmd/bd/migrate.go updated to
call through package migrations.
- internal/storage/embeddeddolt/store.go opens a fresh sql.DB after
the schema-migration tx commits and calls RunCompatMigrations.
- Regression test: synthetic old-schema DB (drop issues.started_at),
reopen, assert the compat runner re-adds the column.
Refs GH#3412.
Hook-bypass-reason: local pre-commit hook fails on Windows with
CGO_ENABLED=0 because cmd/bd/init.go references sanitizeDBName,
defined in cmd/bd/store_factory.go which is gated //go:build cgo.
Reproduced against pristine origin/main; not introduced by this
change. Upstream fix in flight at GH#3402 / GH#3403.