SeniorCI/CD & DevOps for QA
How do you test database migrations in a CI/CD pipeline?
- database migrations
- data integrity
- rollback
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Migrations are high-risk, test them before production. Strategy: (1) Run migrations against a production-schema clone (not empty DB). (2) Test forward migration AND rollback. (3) Verify data integrity after migration - row counts, checksums, sample data validation. (4) Test with production-scale data volume (migration that takes 1 second on dev data may take 30 minutes on production). (5) Zero-downtime migrations - verify the app works with both old and new schema simultaneously during rolling deployments. (6) Include migration in CI with a seeded database.
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.