Flyway vs Liquibase

Comparison

FlywayLiquibase
Formatplain SQL files (and Java)XML / YAML / JSON / SQL changesets
Learning curvevery low: it is just SQLhigher: change types, contexts, preconditions
Multiple databasesone script set per vendor if SQL differsone changelog generates SQL per database
Rollbackwrite an undo script yourself (undo is a paid feature)rollback blocks, many automatic
Conditional changeslimitedpreconditions, contexts, labels
History tableflyway_schema_historyDATABASECHANGELOG + lock table
Spring Boot supportauto-configuredauto-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.