Software Testing & QA (50 Qs)•Part 3: Advanced Internals, Scale & Production Quality (Senior / Lead)
Database Migration Testing: Automated forward migration and rollback validation.
senior LevelFormsTestingDatabases & SQL
In Simple Words: Broken database migrations in production cause multi-hour downtime:
- Automated Migration Test in CI:
- Spin up a fresh ephemeral PostgreSQL container with previous schema version.
- Execute all forward migrations (
up): Verify all tables, indices, and foreign keys build successfully. - Execute rollback migrations (
down): Verify schema rolls back cleanly to zero. - Execute forward migrations again (
up): Verify idempotency and run synthetic data integrity tests.