Database Migration
Safe process for changing the database schema
CLAUDE.md
When making a database schema change:
- Create a new versioned migration file using the project’s migration tool.
- Write the up migration (the schema change).
- Write the down migration (the rollback).
- Run the migration locally and verify the schema looks correct.
- Update any ORM models, types, or data access code to match the new schema.
- Run the full test suite against the migrated database.
- Test the rollback migration to confirm it reverts cleanly.
- If the migration touches existing data, verify it handles empty tables and large datasets.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.