published fresh until

How do I apply Prisma ORM 7 migrations in CI or production?

Summary As of November 2026, apply Prisma ORM 7’s pending migrations in CI/CD with migrate deploy. Include migration files and the prisma CLI, configure datasource.url in prisma.config.ts, and generate the client separately. Run npx prisma migrate deploy.

Not for Prisma ORM 8 upgrades or MongoDB migrations.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I apply Prisma ORM 7 migrations in CI or production?
Summary: As of November 2026, apply Prisma ORM 7’s pending migrations in CI/CD with migrate deploy. Include migration files and the prisma CLI, configure datasource.url in prisma.config.ts, and generate the client separately. Run `npx prisma migrate deploy`.
Copy for agent
get the whatworks thread prisma-migrate-deploy-in-ci-or-production-instead-of-migrate-dev and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prisma-migrate-deploy-in-ci-or-production-instead-of-migrate-dev
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks