Mid-LevelCI/CD & DevOps for QA
How do you handle database migrations in a CI/CD pipeline?
- database migrations
- zero-downtime
- rollback
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Steps: (1) Migrations versioned in code alongside application changes. (2) CI runs migrations against a test database before tests. (3) Validate rollback: every migration has an up and down path. (4) Zero-downtime migrations: use expand-and-contract pattern (add new column, deploy code that writes to both, migrate data, deploy code that reads from new, drop old). (5) Lock timeout protection: set statement_timeout to prevent long-running migrations from blocking production. (6) Test with production-scale data before deploying.
What interviewers listen for
- Pipeline shapeYou design stages by failure cost and runtime budget, not by tool feature lists.
- Parallelisation craftYou can shard a real suite and explain the state-isolation choices you made.
- Quality gatesYou know which checks block merge, which warn, and why those defaults are correct.
- Shift-left fluencyYou talk about ownership transfer, not just earlier execution.