Scrivio Interview library

Schema migration

19 questions in 5 subtopics.

Flyway

ConceptFoundations6 min read
How does Flyway apply migrations in a Spring Boot application? Explain versioned and repeatable migrations and the schema history table.
DebuggingFoundations6 min read
Startup fails with 'Validate failed: Migration checksum mismatch for migration version 3'. What happened and what should you do?
ScenarioIntermediate6 min read
You must introduce Flyway into a service whose production database already has 80 tables created by hand and by Hibernate ddl-auto=update. How do you do it safely?
LeadershipPrincipal6 min read
Migration scripts accumulate for years: one service has 1,400 Flyway migrations and new environments take 40 minutes to build. How do you think about migration history as a long-term asset and cost?

Liquibase

ConceptFoundations6 min read
How does Liquibase track changes, and how does it differ from Flyway in approach?
DebuggingIntermediate7 min read
A deployment hangs at startup with 'Waiting for changelog lock....' from Liquibase. What happened and how do you recover?
LeadershipAdvanced6 min read
Half your teams use Flyway and half Liquibase. Would you standardise, and how would you decide?
LeadershipPrincipal7 min read
Licence and edition changes for developer tools (database migration tools among them) have forced some companies to re-evaluate dependencies. How would you manage licence and vendor risk for build and data tooling across the organisation?

Zero-downtime schema changes

ConceptFoundations6 min read
Why can't you simply rename a column in a migration when the application is deployed with rolling updates?
DebuggingIntermediate7 min read
A simple ALTER TABLE ... ADD COLUMN migration caused a 5-minute outage on a busy PostgreSQL table, although the statement itself is fast. What happened?
ScenarioIntermediate7 min read
Plan a zero-downtime migration to add a NOT NULL column with a computed value to a 500-million-row PostgreSQL table, and to add an index on it.
DesignAdvanced6 min read
Define the company process for database schema changes so that hundreds of deploys per week never cause downtime.
LeadershipPrincipal7 min read
A ten-year-old monolith's schema has 900 tables used by 40 teams and no one can change core tables safely. What long-term strategy would you set?

Migrations in CI

ScenarioFoundations6 min read
How do you test database migrations in a CI pipeline for a Spring Boot service?
DesignIntermediate6 min read
Design CI checks that catch dangerous migrations before they reach production.
ScenarioAdvanced6 min read
Should migrations run at application startup, in a Kubernetes init container, or as a separate pipeline step? Discuss the trade-offs for a service with 30 instances.

SQL init scripts

ConceptFoundations7 min read
How do Spring Boot's schema.sql and data.sql scripts work, which properties control them, and how do they interact with Hibernate's ddl-auto and Flyway?
DebuggingIntermediate7 min read
After moving a service from H2 to PostgreSQL in staging, startup fails because data.sql inserts duplicate rows on every restart, and in another service data.sql did not run at all. Explain both behaviours.
LeadershipAdvanced7 min read
Some teams seed reference data with data.sql, others with Flyway, others with application code at startup, and environments have drifted. What standard would you set for schema and reference data initialisation?