Database Migrations and Rollbacks

Application deployment and database schema changes must be coordinated carefully. A deployment can fail even when the application code is correct if the database migration is incompatible with the currently running version.

Prefer backwards-compatible schema changes when possible. For example, add a new column before deploying code that requires it, then remove the old column only after the old code is no longer running.

Rollback planning is essential because application rollback does not automatically reverse database changes.

Key Takeaways
  • Database changes can outlive application deployments.
  • Prefer backwards-compatible migration strategies.
  • A code rollback does not necessarily mean a database rollback.