npx skills add ...
npx skills add prisma/cursor-plugin --skill prisma-cli-migrate-dev
npx skills add prisma/cursor-plugin --skill prisma-cli-migrate-dev
prisma migrate dev. Reference when using this Prisma feature.
Creates and applies migrations during development. Requires a shadow database.
_prisma_migrations table| 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 |
--skip-generate - Run prisma generate explicitly--skip-seed - Run prisma db seed explicitlyPrompts for migration name if schema changed.
Useful for reviewing migration SQL before applying.
Created in prisma/migrations/:
If migrate dev detects drift (manual database changes or edited migrations), it prompts to reset:
migrate deploy)migrate deploy)db push instead)When a migration would cause data loss:
migrate dev requires a shadow database for drift detection. Configure in prisma.config.ts:
For local Prisma Postgres (prisma dev), shadow database is handled automatically.
prisma/migrations/
├── 20240115120000_add_users_table/
│ └── migration.sql
├── 20240116090000_add_posts/
│ └── migration.sql
└── migration_lock.tomlDrift detected: Your database schema is not in sync.
Do you want to reset your database? All data will be lost.// 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_atprisma migrate dev --name remove_field
# Warning: You are about to delete data...
# Accept with: --accept-data-lossexport default defineConfig({
datasource: {
url: env('DATABASE_URL'),
shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
},
})