一键导入
prisma-cli-migrate-deploy
prisma migrate deploy
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
prisma migrate deploy
用 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-deploy |
| description | prisma migrate deploy |
| license | MIT |
| metadata | {"author":"prisma","version":"7.0.0"} |
Applies pending migrations in production/staging environments.
prisma migrate deploy
prisma/migrations/_prisma_migrations table| Option | Description |
|---|---|
--schema | Custom path to your Prisma schema |
--config | Custom path to your Prisma config file |
prisma migrate deploy
# GitHub Actions example
- name: Apply migrations
run: npx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
# Run migrations before starting app
CMD npx prisma migrate deploy && node dist/index.js
| 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 |
Development: Create migrations locally
prisma migrate dev --name add_feature
Commit: Include migration files in version control
git add prisma/migrations
git commit -m "Add feature migration"
Deploy: Apply in production
prisma migrate deploy
If a migration fails, migrate deploy exits with error. The failed migration is marked as failed in _prisma_migrations.
To fix:
prisma migrate resolve --applied <migration_name>prisma migrate deployprisma migrate status
Shows pending and applied migrations before deploying.
Ensure prisma.config.ts has the production database URL:
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
datasource: {
url: env('DATABASE_URL'),
},
})
migrate status before migrate deploy in CImigrate dev in production