What I do
- Analyze current schema or framework version
- Plan migration steps with proper ordering
- Generate migration files in the project's format
- Create rollback strategies for each step
- Validate data integrity considerations
When to use me
Use this skill when you need to:
- Create database migrations (schema changes, data migrations)
- Upgrade a framework or library to a new major version
- Migrate from one technology to another (e.g., ORM switch)
Database Migration Process
- Analyze: Read current schema and understand relationships
- Plan: List all changes needed, order by dependencies
- Generate: Create migration files in the project's format:
- Prisma:
prisma/migrations/ - TypeORM:
src/migrations/ - Django:
app/migrations/ - Flyway:
db/migration/ - Liquibase:
db/changelog/
- Rollback: For each migration, create the inverse operation
- Validate: Check for data loss risks and foreign key constraints
Framework Migration Process
- Inventory: List all breaking changes from changelog
- Assess: Identify affected code in the project
- Plan: Create ordered list of changes
- Execute: Make changes incrementally
- Test: Verify after each step
Migration File Template
-- Migration: description
-- Created: YYYY-MM-DD
-- Author: [generated]
-- UP
ALTER TABLE ...;
-- DOWN (rollback)
ALTER TABLE ...;
Rules
- Always include rollback/down migrations
- Never drop columns without data backup strategy
- Consider zero-downtime migration patterns for production
- Test migrations on a copy of production data
- Document any manual steps required