Schema migration
19 questions in 5 subtopics.
Flyway
How does Flyway apply migrations in a Spring Boot application? Explain versioned and repeatable migrations and the schema history table.Startup fails with 'Validate failed: Migration checksum mismatch for migration version 3'. What happened and what should you do?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?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
How does Liquibase track changes, and how does it differ from Flyway in approach?A deployment hangs at startup with 'Waiting for changelog lock....' from Liquibase. What happened and how do you recover?Half your teams use Flyway and half Liquibase. Would you standardise, and how would you decide?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
Why can't you simply rename a column in a migration when the application is deployed with rolling updates?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?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.Define the company process for database schema changes so that hundreds of deploys per week never cause downtime.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
How do you test database migrations in a CI pipeline for a Spring Boot service?Design CI checks that catch dangerous migrations before they reach production.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
How do Spring Boot'sschema.sql and data.sql scripts work, which properties control them, and how do they interact with Hibernate's ddl-auto and Flyway?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.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?No question matches these choices.