Database Schema and Migrations

Evolve schema safely while protecting production data and deployment reliability.

  • Use migration-based schema evolution.
  • Keep migrations backward compatible across rolling deploy windows.
  • Separate write-path changes from cleanup migrations.

Alternatives and when to choose them

  • Schema sync in development only for prototypes.
  • Manual DBA-led migrations in highly governed enterprise environments.

Implementation checklist

  • Review every migration for lock/runtime risk.
  • Run migrations in CI and staging before production.
  • Add rollback strategy (or forward-fix plan) for every high-risk migration.

Common pitfalls

  • Long-running lock-heavy migrations during peak traffic.
  • Deploying code that expects columns before migration is applied.

See also: Infrastructure setup

On this page