AEROSIM-TS-18
Create reproducible PostgreSQL migrations
All committed Prisma migrations apply successfully to a clean PostgreSQL database and reproduce the expected schema.
- Verified flow state
- Done
- Owner
- AeroSim Architecture and Delivery
- Feature
- AEROSIM-FT-43
- Component
- Pilot Data Store — Prisma migrations
- Repository
- corp-v1-aerosim/corp-v1-aerosim
Delivery scope
Commit the initial PostgreSQL migration for PilotRecord and a disposable PostgreSQL fixture that applies the full migration directory from an empty database, reapplies with no changes, and detects drift against schema.prisma. Primary files: applications/api/prisma/migrations/0001_create_pilot_record/migration.sql, applications/api/prisma/migrations/migration_lock.toml, applications/api/tests/integration/migrations.test.ts, compose.postgres.test.yaml.
Implementation contract
Implementation artifacts
- applications/api/prisma/migrations/0001_create_pilot_record/migration.sql
- applications/api/prisma/migrations/migration_lock.toml
- applications/api/tests/integration/migrations.test.ts
- compose.postgres.test.yaml
Inputs
- Empty PostgreSQL 16 database started from compose.postgres.test.yaml
- Ordered SQL files under applications/api/prisma/migrations and schema.prisma
Outputs
- PilotRecord table, compound unique constraint, owner index, and _prisma_migrations history
- Zero-drift result from prisma migrate diff after deployment
Failure boundaries
- Fail when migration SQL is reordered, edited after application, or cannot run in a transaction.
- Fail the drift check when database columns, indexes, or constraints differ from schema.prisma.
Excluded scope
- Production backup, point-in-time recovery, high availability, and data-retention policies are deployment operations outside this migration task.
Verification steps
- docker compose -f compose.postgres.test.yaml up -d && pnpm --filter @aerosim/api prisma migrate deploy
- pnpm --filter @aerosim/api test:integration -- migrations.test.ts; assert a second migrate deploy reports no pending migrations.
Traceability
Dependencies
- AEROSIM-TS-17Canonical ID: TASK-0017
UI/UX applicability
non_visual
This Task owns technical or behavioral acceptance and does not claim direct visual conformance to the approved UI/UX package.
Acceptance evidence
Verified delivery: application PR #29 reviewed head f5b0cd1e36577bbbcc6bde85042a48eb6f83fa87, exact-head validation task 1840 succeeded, merged as db116334ef1c66588377b3997fc47ad47e65304b; Wave 5 integrated application head e6212bf637045138da191634fe113285156426b3 passed publish task 1856 and validate task 1857. Release completion verified on product 1.0.0.0 at GitOps revision 5d3712d89dfbf7dacd993348e55f497d126c7bf9 with Argo Synced/Healthy, exact image digests, authenticated API/database access, and three-world configured-flight acceptance.
Current evidence boundary
No current implementation, acceptance, release, or deployment evidence is claimed for this planned Task. Any prior implementation may be used only as prototype and discovery evidence.