Migrations
How migrations work
What a Prisma ORM migration is, the plan-review-apply loop, and how operations check the database.
The migration graph
How Prisma ORM models migrations as a graph of contract states, why that makes branching and parallel work safe, and the commands to inspect it.
Generating a migration
A tutorial for the migration plan command, from a contract change to a migration you can review, without connecting to a database.
Editing a migration
How to edit a Prisma ORM migration.ts by filling placeholder data transforms, writing typed backfills, using rawSql, and recompiling ops.json with node migration.ts.
Applying a migration
How the Prisma ORM db migrate command applies migrations, from targeting refs and hashes and previewing with --show to checking status and running safely in development and production.
Rollbacks and recovery
How to roll back a Prisma ORM migration, recover from a migration that failed, and fix a database that changed without a migration.