Migration Safety Skill
Purpose: Validate Prisma schema changes for safety and generate migration reports.
Trigger
When: prisma/schema.prisma is modified
Context Needed: Schema diff, current database state
MCP Tools: prisma-migrate-dev, activate_prisma_migration_tools
Risk Levels
| Change | Risk | Action |
|---|---|---|
| Drop table | 🔴 Critical | Backup + approval |
| Drop column | 🔴 Critical | Backup + approval |
| Remove enum value | 🔴 Critical | Check usage |
| Change column type | 🟠 High | Validate data |
| Make nullable→required | 🟠 High | Check nulls |
| Add required column | 🟡 Medium | Default needed |
| Add optional column | 🟢 Low | Safe |
| Add index | 🟢 Low | Safe |
Migration Checklist
- • Descriptive migration name
- • Backup before destructive changes
- • Test on staging first
- • Update related documentation
Commands
bash
# Generate migration bunx prisma migrate dev --name [description] # Check status bunx prisma migrate status # Apply to production bunx prisma migrate deploy