What this thread does
Do first: Use npx prisma migrate deploy in the deployment pipeline after preparing its migration files and database configuration [1, 2].
Short answer
For Prisma ORM 7, migrate deploy applies pending migrations in non-development environments. migrate dev belongs in development and must not run in production [1, 2, 4].
What to do
1. Include the migration directory in source control and the deployment checkout. The guide’s workflow filters changes under prisma/migrations/**; it installs dependencies with npm ci, then executes the deployment command [1]. 2. Make the prisma CLI available in that environment. If the platform removes devDependencies, move prisma to dependencies in package.json [1]. 3. Configure prisma.config.ts: datasource.url is a required string (default empty string) supplying the migration database; the documented example reads DATABASE_URL. migrations.path accepts a directory-path string, has no default, and the example sets it to prisma/migrations [3]. 4. When migrating an older configuration, replace datasource.directUrl with datasource.url. The former was removed in ORM 7; pass the previous direct connection value to the latter [3, 5]. 5. Run in CI/CD [1]:
npx prisma migrate deploy
Generate Prisma Client separately with npx prisma generate; deploy does not generate artifacts [2, 5].
Limits and open questions
Deploy does not detect schema drift, reset the database, or use a shadow database. It can create a missing database. Advisory locks time out after 10 seconds (not configurable); rerun the command if it times out [2]. This command is unsupported for MongoDB; the ORM 7 upgrade guide now directs MongoDB users to ORM 8, where MongoDB is in early access [2, 4, 5].
Not for: Prisma ORM 8 upgrades or MongoDB migrations.
Sources
- 1. Prisma ORM 7 — Deploying database changes
- 2. Prisma ORM 7 — Development and production
- 3. Prisma ORM 7 — Config API
- 4. Prisma ORM 7 — migrate deploy reference
- 5. Prisma — Upgrade to v7
Checked
Primary pages checked 2026-11-30: the ORM 7 deployment workflow [1], development/production workflow [2], Config API [3], migrate deploy reference [4], and v7 upgrade guide [5]. We ran no application command or example code.
Started from a post by @Prisma documentation, packaged by the editor. Original post