You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Squash the 30 EF migrations into a single InitialCreate before first production deploy #245
Split from the deployment-readiness audit (#244, "Migrations" checklist item).
Problem
src/Cluckwork.Infrastructure/Persistence/Migrations/ holds 30 migrations, and Database:MigrateOnStartup replays all of them on every fresh database. 12 of them contain raw SQL / data operations (ConvertLotsAndSalesToEggGradeIds, AddBirdMovementEntryRefAndBackfill, backfills in expenses/product-catalog/inventory, …) that were written for mid-history data states. On an empty database they touch 0 rows, but they still execute — a first production deploy runs three weeks of schema archaeology instead of one clean CREATE pass.
Proposal
Squash to a single InitialCreate generated from the current model, before the first real-world deploy:
Delete the Migrations/ folder (including *.Designer.cs and the model snapshot).
dotnet ef migrations add InitialCreate → one migration + fresh snapshot.
Verify: dotnet build clean, integration tests green (Testcontainers spins a fresh Postgres and exercises the new migration end-to-end).
Why now
No production database exists yet. After go-live, squashing requires baselining every deployed DB's __EFMigrationsHistory; today it costs nothing there.
Fresh deploys (and every Testcontainers run) apply one migration instead of 30 — faster startup, and none of the mid-history backfill SQL runs against production.
Impact on existing databases
Any DB that already has rows in __EFMigrationsHistory (local dev DB from deploy/docker-compose.dev.yml, any demo instance) will fail MigrateOnStartup after the squash — the old history names no longer match. These are disposable: drop and recreate (docker compose -f deploy/docker-compose.dev.yml down -v && up -d). Call this out in the PR description.
Acceptance
Single InitialCreate migration; schema identical to the pre-squash snapshot (integration suite green).
Fresh docker compose -f deploy/docker-compose.yml up --build boots, seeds, and runs the egg loop.
Activity
fix(api): backfill legacy idempotency rows and release the connection…
fix(api): make write idempotency atomic across replicas (#307) (#337)
chore(db): squash the 34 EF migrations into a single InitialCreate (#245
feat(auth): tell the operator when an instance has no admin yet (#363)
fix(sim): unbreak the #243 harness against main, with a local self-ch…
fix(db): fold credential-epoch migration into InitialCreate (#364)
docs: close Codex review gaps in the quality-egg reconciliation design
docs: drop the second migration and require Active as well as IsSaleable
fix(db): fold credential-epoch migration into InitialCreate (#364)
Credential epoch: per-request revocation checks (#399)
feat(eggs): persist condition-grade bindings and entry snapshots (#396)
docs(migrations): make #407 the cutover to one migration per change (#…
feat(eggs): make cracked and dirty eggs sellable stock via condition …