Interview Prep/CI/CD/Deployment Strategies and GitOps

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 →

  1. Use expand-contract: first add the new column (nullable), deploy code that writes both, backfill, switch reads, and only later drop the old column.
  2. Run migrations as a separate pre-deploy job (Flyway/Liquibase) with timeouts and lock awareness.
  3. 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.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Deployment Strategies and GitOps