Expand-Contract Migrations

Last Modified on
zettel devops release management

Expand-contract migrations, also known as parallel-change migrations or zero-downtime migrations, are a two-phase approach to database schema changes that prioritize backward compatibility and minimize system downtime. This pattern is especially useful in continuously deployed systems, where database migrations need to be seamless and non-disruptive to maintain service quality.

The expand-contract migration process involves two main phases:

  1. Expand Phase: In this phase, the database schema is expanded to accommodate the new schema changes. This often involves adding new columns, tables, or indices without removing or altering existing ones. The application code is then updated to use the new schema elements while still maintaining compatibility with the old schema.

  2. Contract Phase: After the expand phase is complete and the application has successfully transitioned to using the new schema, the contract phase begins. This phase involves removing or altering the old schema elements that are no longer needed, effectively “contracting” the database schema to its final state.

This approach ensures that the database remains compatible with both the old and new application code during the migration process, allowing for smooth transitions without requiring system downtime or impacting end users. By prioritizing backward compatibility and minimizing disruption, expand-contract migrations have become a popular choice for organizations that require efficient and reliable database management.

  • Release Management MOC
  • Big-Bang Migrations
  • Branch by Abstraction|branch by abstraction

These are possible follow-up zettels…

  1. Expand-Contract Migrations: Best Practices
  2. Expand-Contract Migrations: Common Pitfalls and How to Avoid Them
  3. Expand-Contract Migrations: Handling Data Transformations
  4. Expand-Contract Migrations vs. Lock-Step Migrations: A Comparison
  5. Strategies for Testing Expand-Contract Migrations
  6. Expand-Contract Migrations in Microservices Architectures
  7. Leveraging Feature Toggles in Expand-Contract Migrations
  8. Using Expand-Contract Migrations with Different Database Types (Relational, NoSQL)
  9. Expand-Contract Migrations: Rollback Strategies
  10. Tools and Libraries for Implementing Expand-Contract Migrations
    • Zettel: Backward Compatibility in Expand-Contract Migrations
    • Zettel: Minimized Downtime with Expand-Contract Migrations
    • Zettel: Flexibility and Scalability of Expand-Contract Migrations

These note titles can help you explore various aspects of expand-contract migrations, such as best practices, testing strategies, comparisons with other migration approaches, and integration with different database types or architectural patterns.


Side Widget
You can put anything you want inside of these side widgets. They are easy to use, and feature the Bootstrap 5 card component!