Workflow Development

Database Migration

Safe process for changing the database schema

databasemigrationbackend
CLAUDE.md

When making a database schema change:

  1. Create a new versioned migration file using the project’s migration tool.
  2. Write the up migration (the schema change).
  3. Write the down migration (the rollback).
  4. Run the migration locally and verify the schema looks correct.
  5. Update any ORM models, types, or data access code to match the new schema.
  6. Run the full test suite against the migrated database.
  7. Test the rollback migration to confirm it reverts cleanly.
  8. 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.

get crystl