package database import "testing" // TestEmbeddedMigrationsUnique guards against duplicate migration // version prefixes. mail-gateway hit this on 2026-05-08 when two // parallel agents both committed a 0092_*.sql; goose panicked at // startup, the API restart-looped, the cluster rolling-upgrade hung. // // Cheap assertion that runs as part of `go test ./...` — fails the // build before `make deb` ever produces an artefact, so the bad // version never reaches the APT registry. Same logic also runs at // service start via Migrate() and via `edgeguard-ctl migrate check` // in postinst (defense in depth). func TestEmbeddedMigrationsUnique(t *testing.T) { if err := ValidateMigrations(); err != nil { t.Fatalf("embedded migrations failed validation: %v", err) } }