name: db-migrate description: Safely handle database migrations with backup verification and rollback planning
Database Migration Skill
Safety Rules
- •ALWAYS backup before migrating
- •NEVER drop tables in production
- •Review generated SQL before execution
Workflow
- •Check current migration status
- •Generate migration file
- •Review the changes
- •Ask for confirmation
- •Run migration
- •Verify success
Pre-Migration Checklist
- • Database backup exists
- • Migration has been tested locally
- • Rollback plan documented
- • Team notified of migration
Commands by Framework
Prisma
bash
npx prisma migrate dev --name $ARGUMENTS npx prisma migrate deploy # Production
Django
bash
python manage.py makemigrations python manage.py migrate
Rails
bash
rails db:migrate
Rollback Guidance
If migration fails:
- •Check migration logs
- •Run rollback command
- •Restore from backup if needed
- •Document what went wrong