beads/internal/storage/dolt/migrations
seanmartinsmith f368f98830
fix: wire embedded backend compat migrations by relocating runner (#3413)
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.
2026-04-24 13:56:41 -07:00
..
001_wisp_type_column.go fix(dolt): server mode works without CGO (#1805) 2026-02-17 23:51:07 -08:00
002_spec_id_column.go fix(dolt): server mode works without CGO (#1805) 2026-02-17 23:51:07 -08:00
003_orphan_detection.go fix: remove orphan detection from compat migration hot path (#3344) (#3378) 2026-04-20 17:42:21 -07:00
004_wisps_table.go /internal/storage: remove conflicting column on schema migration table 2026-04-14 15:36:26 -07:00
005_wisp_auxiliary_tables.go /internal/storage: remove conflicting column on schema migration table 2026-04-14 15:36:26 -07:00
006_issue_counter.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
007_infra_to_wisps.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
008_wisp_dep_type_index.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
009_cleanup_autopush_metadata.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
010_uuid_primary_keys.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
011_add_no_history_column.go feat: add --no-history flag to bd create — skip Dolt commits without GC eligibility 2026-03-15 19:28:48 +00:00
012_drop_hop_columns.go refactor: remove HOP fields from beads schema (bd-vcps) 2026-03-20 18:37:13 -07:00
013_drop_child_counters_fk.go fix(schema): drop child_counters FK that breaks set-state on agent beads 2026-03-27 10:06:44 -07:00
014_wisp_events_created_at_index.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
015_custom_status_type_tables.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
016_backfill_custom_tables.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
016_backfill_custom_tables_test.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
017_add_started_at_column.go fix(schema): repair v0.63→v1.0 upgrades where issues.started_at is missing (GH#3363) (#3365) 2026-04-20 16:57:11 -07:00
017_add_started_at_column_test.go fix(schema): repair v0.63→v1.0 upgrades where issues.started_at is missing (GH#3363) (#3365) 2026-04-20 16:57:11 -07:00
helpers.go /internal/storage/dolt: optimize schema migrations 2026-04-06 14:11:32 -07:00
migrations_test.go ci: install dolt binary on Linux and macOS test runners (#3440) 2026-04-24 06:58:40 -07:00
runner.go fix: wire embedded backend compat migrations by relocating runner (#3413) 2026-04-24 13:56:41 -07:00
testmain_test.go /{cmd,internal,scripts}: use dsn helpers 2026-04-06 15:56:37 -07:00