
prisma-cli-migrate-dev
✓ Official★ 8by prisma · part of prisma/cursor-plugin
prisma migrate dev. Reference when using this Prisma feature.
prisma migrate dev. Reference when using this Prisma feature.
Inspect the full instructions your agent will receiveExpandCollapse
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 dev. Reference when using this Prisma feature.
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-cli-migrate-dev
Download ZIPGitHub8
prisma migrate dev
Creates and applies migrations during development. Requires a shadow database.
Command
prisma migrate dev [options]
What It Does
-
Runs existing migrations in shadow database to detect drift
-
Applies any pending migrations
-
Generates new migration from schema changes
-
Applies new migration to development database
-
Updates
_prisma_migrationstable
Options
Option Description
--name / -n Name the migration
--create-only Create a new migration but do not apply it
--schema Custom path to your Prisma schema
--config Custom path to your Prisma config file
--url Override the datasource URL from the Prisma config file
Removed in v7
-
--skip-generate- Runprisma generateexplicitly -
--skip-seed- Runprisma db seedexplicitly
Examples
Create and apply migration
prisma migrate dev
Prompts for migration name if schema changed.
Named migration
prisma migrate dev --name add_users_table
Create without applying
prisma migrate dev --create-only
Useful for reviewing migration SQL before applying.
Full workflow (v7)
prisma migrate dev --name my_migration
prisma generate # Must run explicitly in v7
prisma db seed # Must run explicitly in v7
Migration Files
Created in prisma/migrations/:
prisma/migrations/
├── 20240115120000_add_users_table/
│ └── migration.sql
├── 20240116090000_add_posts/
│ └── migration.sql
└── migration_lock.toml
Schema Drift Detection
If migrate dev detects drift (manual database changes or edited migrations), it prompts to reset:
Drift detected: Your database schema is not in sync.
Do you want to reset your database? All data will be lost.
When to Use
-
Local development
-
Adding new models/fields
-
Changing relations
-
Creating indexes
When NOT to Use
-
Production deployments (use
migrate deploy) -
CI/CD pipelines (use
migrate deploy) -
MongoDB (use
db pushinstead)
Common Patterns
After schema changes
// schema.prisma - Add new field
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
createdAt DateTime @default(now()) // New field
}
prisma migrate dev --name add_created_at
Handling data loss warnings
When a migration would cause data loss:
prisma migrate dev --name remove_field
# Warning: You are about to delete data...
# Accept with: --accept-data-loss
Shadow Database
migrate dev requires a shadow database for drift detection. Configure in prisma.config.ts:
export default defineConfig({
datasource: {
url: env('DATABASE_URL'),
shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
},
})
For local Prisma Postgres (prisma dev), shadow database is handled automatically.
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-cli-migrate-devRun this in your project — your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.