Area: Database
Priority: P1 — High
Description
Currently using synchronize: true (acceptable in development but dangerous in production). Schema changes must be controlled via migrations to prevent data loss, enable zero-downtime deploys, and ensure reproducibility across environments.
Acceptance Criteria
Technical Notes
- File naming:
<timestamp>-<Name>.ts (TypeORM default)
- Reversible: every migration has both
up and down
- No data migrations without explicit runbook
- Reference: https://typeorm.io/migrations
Description
Currently using
synchronize: true(acceptable in development but dangerous in production). Schema changes must be controlled via migrations to prevent data loss, enable zero-downtime deploys, and ensure reproducibility across environments.Acceptance Criteria
synchronize: falsewhenNODE_ENV=productioninsrc/config/typeorm.config.tspackage.json:migration:generate,migration:run,migration:revert,migration:showsrc/config/data-source.tsdocs/MIGRATIONS.mdwith naming conventions and best practicesmigration-checkthat fails on pending schema driftTechnical Notes
<timestamp>-<Name>.ts(TypeORM default)upanddown