Labsco
prisma logo

prisma-cli-migrate-deploy

✓ Official8

by prisma · part of prisma/cursor-plugin

prisma migrate deploy

🔥🔥🔥✓ VerifiedFreeNeeds API keys
🧩 One of 7 skills in the prisma/cursor-plugin package — works on its own, and pairs well with its siblings.

prisma migrate deploy

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.

by prisma

prisma migrate deploy npx skills add https://github.com/prisma/cursor-plugin --skill prisma-cli-migrate-deploy Download ZIPGitHub8

Command

Copy & paste — that's it
prisma migrate deploy

What It Does

  • Applies all pending migrations from prisma/migrations/

  • Updates _prisma_migrations table

  • Does NOT generate new migrations

  • Does NOT run seed scripts

  • Safe for CI/CD and production

Options

Option Description --schema Custom path to your Prisma schema --config Custom path to your Prisma config file

When to Use

  • Production deployments

  • Staging environments

  • CI/CD pipelines

  • Any non-development environment

Examples

Basic deployment

Copy & paste — that's it
prisma migrate deploy

In CI/CD pipeline

Copy & paste — that's it
# GitHub Actions example
- name: Apply migrations
 run: npx prisma migrate deploy
 env:
 DATABASE_URL: ${{ secrets.DATABASE_URL }}

Docker deployment

Copy & paste — that's it
# Run migrations before starting app
CMD npx prisma migrate deploy && node dist/index.js

Comparison with migrate dev

Feature migrate dev migrate deploy Creates migrations Yes No Applies migrations Yes Yes Detects drift Yes No Prompts for input Yes No Uses shadow database Yes No Safe for production No Yes Resets on issues Prompts Fails

Production Workflow

Development: Create migrations locally

Copy & paste — that's it
prisma migrate dev --name add_feature

Commit: Include migration files in version control

Copy & paste — that's it
git add prisma/migrations
git commit -m "Add feature migration"

Deploy: Apply in production

Copy & paste — that's it
prisma migrate deploy

Error Handling

Failed migration

If a migration fails, migrate deploy exits with error. The failed migration is marked as failed in _prisma_migrations.

To fix:

  • Resolve the issue (fix SQL, database state, etc.)

  • Mark as resolved: prisma migrate resolve --applied <migration_name>

  • Re-run: prisma migrate deploy

Check status first

Copy & paste — that's it
prisma migrate status

Shows pending and applied migrations before deploying.

Best Practices

  • Always run migrate status before migrate deploy in CI

  • Have a rollback plan (backup before migrations)

  • Test migrations in staging first

  • Never use migrate dev in production