migration new
Scaffold a Prisma 8 migration package for manual authoring.
migration new creates a migration package with a migration.ts file for manual authoring.
Use it when the generated plan is not enough and you want to write the migration operations yourself. The command is offline. It does not consult the database.
Usage
bunx prisma@latest migration new --name split-nameOptions
| Option | What it does |
|---|---|
--name <slug> | Sets the migration directory name suffix. |
--from <hash> | Sets the starting contract hash. Defaults to the latest migration target. |
--config <path> | Read this config file instead of ./prisma.config.ts. |
--json | Prints a machine-readable result. |
Examples
bunx prisma@latest migration new --name split-name
bunx prisma@latest migration new --name custom-fk --from abc123After scaffolding
Write the migration body in migration.ts, then run the file with Node so it emits ops.json and attests the package:
node migration.tsInspect the result:
bunx prisma@latest migration show <migration-dir>Apply the migration only after review:
bunx prisma@latest db migrate --db "$DATABASE_URL"Manual migrations should still end at a contract state that matches the emitted contract.
