.NET Architecture & System Design Interview Question #181

What is backward-compatible database migration?

Deployment, Cloud Operations, SRE & Senior System Design Scenarios Senior Advanced

Quick Interview Answer

A backward-compatible migration changes the database in a way that both the currently deployed application and the new application can operate during a staged rollout.

Detailed Explanation

A backward-compatible migration changes the database in a way that both the currently deployed application and the new application can operate during a staged rollout.

A common approach is expand-and-contract: add new schema first, deploy code that can work with the transition, migrate data if necessary, and remove old schema only after old application versions are gone.

Code Example

1. EXPAND: add new column/table
2. Deploy compatible application
3. Migrate/backfill data
4. Stop old version
5. CONTRACT: remove old schema