Prisma 8 is here.Read the docs

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-name

Options

OptionWhat 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.
--jsonPrints a machine-readable result.

Examples

bunx prisma@latest migration new --name split-name
bunx prisma@latest migration new --name custom-fk --from abc123

After 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.ts

Inspect 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.

On this page