advanced
Migrations
Coordinate Prisma Migrate with environments, drift detection, shadow databases, data changes, and deploy safety.
Prisma Migrate turns schema diffs into SQL migration files tracked in `prisma/migrations`. Development workflows (`migrate dev`, reset) differ from production (`migrate deploy`).
| Command context | Purpose | |-----------------|---------| | Development | Iterate schema, shadow DB checks | | CI / production | Apply reviewed migrations only |
On interviews: shadow databases, drift detection, migration history, generated SQL review, expand-contract changes.
Common pitfalls: using reset workflows in production; renames that drop data; skipping review because SQL was generated.
The trade-off is migration automation versus DDL safety.
Checklist:
- Use deploy-safe migration commands.
- Review generated SQL.
- Plan drift and backfill handling.
- Keep migration history in version control.