Skip to main content

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 shape
    You design stages by failure cost and runtime budget, not by tool feature lists.
  • Parallelisation craft
    You can shard a real suite and explain the state-isolation choices you made.
  • Quality gates
    You know which checks block merge, which warn, and why those defaults are correct.
  • Shift-left fluency
    You talk about ownership transfer, not just earlier execution.

See all 34 ci/cd questions

Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026