intermediate
Migrations
Generate, edit, and apply migrations with review of SQL, ordering, reversibility, and production rollout risks.
TypeORM migrations record database changes as TypeScript classes with `up` and `down` methods. Generated migrations need review—entity metadata diffs can produce destructive SQL.
On interviews: generation versus hand editing, environment configuration, `synchronize: true` dangers in production, rollout planning.
Common pitfalls: schema sync in production; down migrations not restoring lost data; missing data transformation steps on renames.
The trade-off is codegen from entities versus explicit SQL ownership.
Checklist:
- Disable production synchronize.
- Review up and down SQL.
- Plan data migration separately.
- Version migrations like application code.