Database schema must change with zero downtime during a rolling deploy.
AdvancedScenarioDeployment Strategies and GitOps
Answer
Situation read → Old and new app versions share a DB during rollout.
What I'd do →
- Use expand-contract: first add the new column (nullable), deploy code that writes both, backfill, switch reads, and only later drop the old column.
- Run migrations as a separate pre-deploy job (Flyway/Liquibase) with timeouts and lock awareness.
- Never make a breaking migration in the same release as the code that needs it.
Why → Backward-compatible steps allow safe rollback at every stage.
Interview tip → Expand/contract (parallel change) is the key phrase.