test(api): Postgres migration smoke test — apply all migrations to a fresh real DB in CI #196
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit#196
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
PR #195: hand-written raw SQL in
20261112053648_NormalizeUserEmailsLowerreferenced"Users"(table is reallyusers— staging schema is snake_case tables / PascalCase columns). Result:42P01on apply → startupMigrateAsynccrash → staging API crash-looped ~21h (2026-11-12 14:04 deploy → 2026-11-13 fix; 1400+ restarts, every staging-deploy smoke red since).Zero CI coverage exists for this bug class: the test suite uses
EnsureCreatedand never applies migrations (UniqueTenantRootdeliberately documents that its SQL is Postgres-only because tests never apply migrations).What
A dedicated CI leg (or step in api-ci) that:
dotnet ef database update(ordb.Database.MigrateAsync()from a tiny harness) against the empty DB,__EFMigrationsHistoryends at the latest migration,/health/(catches startup-path regressions beyond migrations),MigrateAsynca second time (idempotency / no-op check).Also worth asserting in the smoke: the snake_case-tables/PascalCase-columns naming convention itself (tables must be
users,folders, ...) so a future model rename cannot silently diverge from the live schema.Constraints
DesignTimeDbContextFactoryhardcodeslocalhost:5432and ignores env vars; use--connection(supported bydotnet ef database update) or the harnessMigrateAsyncroute.failsulit/failsulit) — no secrets needed.Exit
The #195 bug class fails CI on any future PR that adds broken migration SQL. Regression check: reverting the #195 fix on a branch makes this leg red with 42P01.
Source: PR #195, staging incident 2026-11-12 → 2026-11-13.