Database / Liquibase interview questions
What is the difference between Liquibase and Flyway?
Liquibase and Flyway are the two dominant Java database migration tools, and they share the same core goal — versioned, automated schema management — but differ in philosophy, flexibility, and feature set.
| Aspect | Liquibase | Flyway |
|---|---|---|
| Migration format | XML, YAML, JSON, or formatted SQL | SQL or Java callbacks only |
| Rollback support | Built-in, per changeSet | Manual — requires writing separate undo scripts (Pro only for auto-undo) |
| Diff/comparison | diff command compares two databases or snapshots | No built-in diff; requires external tooling |
| Conditional logic | preconditions, contexts, labels, runOnChange, runAlways | Limited — mostly relies on versioned file naming |
| Checksum handling | Strict — fails on checksum mismatch | Strict for versioned migrations; repeatable migrations re-run on checksum change |
| Tracking table name | DATABASECHANGELOG | flyway_schema_history |
| Spring Boot integration | spring-boot-starter-data-liquibase or spring.liquibase properties | spring-boot-starter-flyway or spring.flyway properties |
Flyway is often praised for its simplicity — you name your files V1__create_table.sql and Flyway handles the rest. Liquibase is more powerful but has a steeper learning curve. Teams that need fine-grained rollback, database-agnostic migrations (writing once and targeting Oracle, PostgreSQL, MySQL), or complex conditional logic tend to prefer Liquibase. Teams that want minimal configuration with plain SQL scripts often prefer Flyway.
More Related questions...