Create and apply a new development migration from Prisma schema changes using prisma migrate dev, safely, including handling shadow-database drift prompts.

domain: prisma.io · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Ensure prisma.config.ts has a valid datasource.url (reads from env("DATABASE_URL")) and, if the database can't create/drop databases itself (e.g. some cloud-hosted Postgres), set datasource.shadowDatabaseUrl to a dedicated empty database via env("SHADOW_DATABASE_URL").
  2. Edit prisma/schema.prisma to add/change models, fields, or relations.
  3. Run `npx prisma migrate dev --name <descriptive_name>` e.g. `npx prisma migrate dev --name add_job_title`. This reruns migration history against the shadow database to detect drift, generates a new migrations/<timestamp>_<name>/migration.sql, and applies all pending migrations to your dev database.
  4. If you want to review/edit the generated SQL before it touches the database, use `npx prisma migrate dev --create-only`, hand-edit the resulting migration.sql, then run `npx prisma migrate dev` again to apply it.
  5. After migrating, explicitly run `npx prisma generate` to regenerate Prisma Client, and `npx prisma db seed` if you need seed data — v7 does not do either automatically.
  6. If migrate dev reports schema drift or a migration history conflict, it will prompt to reset the dev database. Only confirm this on a database you can afford to wipe; it runs `migrate reset` under the hood, dropping and recreating all data.
  7. Reference: https://www.prisma.io/docs/cli/migrate/dev, https://www.prisma.io/docs/orm/prisma-migrate/workflows/development-and-production

Known gotchas

Related routes

Run safe Postgres schema migrations without locking production
postgresql · 5 steps · unrated
Configure Liquibase rollback and preconditions for safe schema deployments
liquibase · 6 steps · unrated
Prototype or sync a database schema directly from prisma/schema.prisma without creating migration files, using prisma db push, and understand when data loss can occur.
prisma.io · 7 steps · unrated

Give your agent this knowledge — and 17,200+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans