Review Database Migration
Review workflow for database migration safety
CLAUDE.md
When reviewing a database migration:
- Check that the migration is reversible — there should be a down/rollback migration.
- Check for data loss: does the migration drop columns or tables that contain production data?
- Check for locking: will the migration lock a large table for an extended period? (ALTER TABLE on big tables can be dangerous.)
- Check that default values are set for new NOT NULL columns on existing tables.
- Verify the migration works on an empty database and on a database with existing data.
- Check that ORM models and types are updated to match the schema change.
- If the migration is large or risky, verify there’s a tested rollback plan.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.