Careeroza
Flyway vs Liquibase
Comparison
| Flyway | Liquibase | |
|---|---|---|
| Format | plain SQL files (and Java) | XML / YAML / JSON / SQL changesets |
| Learning curve | very low: it is just SQL | higher: change types, contexts, preconditions |
| Multiple databases | one script set per vendor if SQL differs | one changelog generates SQL per database |
| Rollback | write an undo script yourself (undo is a paid feature) | rollback blocks, many automatic |
| Conditional changes | limited | preconditions, contexts, labels |
| History table | flyway_schema_history | DATABASECHANGELOG + lock table |
| Spring Boot support | auto-configured | auto-configured |
Which One
- Team knows SQL and uses one database (most startups): Flyway.
- Product shipped to customers on different databases, or you need structured rollbacks and preconditions: Liquibase.
- Either is far better than ddl-auto. Pick one per project and stick with it.
Tip: You can generate a first script from your entities: run once with spring.jpa.properties.jakarta.persistence.schema-generation.scripts.action=create and a create-target file, then review and edit it into V1__init.sql.