Koskamo

Applying migrations with db migrate

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

Plan migrations with npx prisma migration plan, then apply them with npx prisma db migrate, which runs them against a database until that database matches your contract; it replaces Prisma ORM 7's prisma migrate deploy and works on PostgreSQL and MongoDB, with SQLite still experimental. Prisma ORM decides what to run by comparing two records: each version of your contract.prisma file is a contract state, and the database stores a marker recording which contract state it matches. db migrate reads the marker and runs the migrations from that state to the contract you last emitted with npx prisma contract emit, and a successful run shows each migration's operations and the marker it wrote. The db commands connect using db.connection in prisma.config.ts; pass --db with a connection string to target a different database such as production. A warning symbol marks a destructive operation, such as setting NOT NULL, and db migrate applies destructive operations without stopping to ask, so review them first with npx prisma migration show <dir> before applying migrations to staging or production. Scope: Prisma ORM 8. Reviewed October 4, 2026.

Source and provenance

Original source
www.prisma.io
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.