Athas Boilerplate

Database Migrations

external-ready

Drizzle migration workflow for schema evolution and safe rollout.

Standard flow

  1. Update schema definitions in libs/db/src/schema/**.
  2. Generate a migration.
  3. Review SQL diff.
  4. Apply migration in development.
  5. Commit schema + migration files together.

Commands

bun run db:generate
bun run db:migrate

Rules

  • keep one logical change per migration when possible
  • never edit already-applied migration files
  • use rollback-forward strategy (new migration to reverse)
  • validate on realistic data before production rollout

Validation checklist

  • migration applies cleanly in local/staging
  • backend typecheck passes
  • changed module paths still pass smoke checks

On this page