一键导入
prisma-cli-migrate-dev
prisma migrate dev. Reference when using this Prisma feature.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
prisma migrate dev. Reference when using this Prisma feature.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
prisma db execute. Reference when using this Prisma feature.
prisma db pull. Reference when using this Prisma feature.
prisma db push. Reference when using this Prisma feature.
prisma db seed. Reference when using this Prisma feature.
prisma debug. Reference when using this Prisma feature.
prisma dev. Reference when using this Prisma feature.
| name | prisma-cli-migrate-dev |
| description | prisma migrate dev. Reference when using this Prisma feature. |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
Creates and applies migrations during development. Requires a shadow database.
prisma migrate dev [options]
_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 explicitlyprisma migrate dev
Prompts for migration name if schema changed.
prisma migrate dev --name add_users_table
prisma migrate dev --create-only
Useful for reviewing migration SQL before applying.
prisma migrate dev --name my_migration
prisma generate # Must run explicitly in v7
prisma db seed # Must run explicitly in v7
Created in prisma/migrations/:
prisma/migrations/
├── 20240115120000_add_users_table/
│ └── migration.sql
├── 20240116090000_add_posts/
│ └── migration.sql
└── migration_lock.toml
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.
migrate deploy)migrate deploy)db push instead)// 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
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
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.