Flyway vs. Liquibase: a side-by-side comparison for database schema migration
When looking for a database CI/CD and schema migration change tool, Flyway and Liquibase are two common options. Understanding the differences between these two tools can help potential users choose the one that best meets their needs.
What Flyway and Liquibase have in common
- Native SQL supported, however Liquibase requires XML changelog to define the changes.
- Database CI/CD with version control system #GitOps (see Database GitOps configuration).
- Auto SQL check (see Auto SQL check).
- Schema Synchronization (see Sync schema).
- Tiered pricing, offering both free and paid plan.
- Open source, both has long history.
What are the differences between Flyway and Liquibase?
While both Flyway and Liquibase are tools for database CI/CD, there are some key differences between the two. The following table summarizes the differences between Flyway and Liquibase.
|Product position||Schema Change & Version Control||Schema Change & Version Control|
|Supported databases||22 Only SQL||50 SQL & NoSQL DB|
|Programming language and installation||Java + JVM||Java + JVM|
|Change execution||SQL script + CLI||Changelog (XML) + CLI|
|Change order||Numbering of SQL files||Changelog (XML)|
|SQL auto check||✅||✅|
|Schema drift detection||✅||✅|
Flyway: A database schema change and version control tool.
Liquibase: A database schema change and version control tool. It helps you track, manage, and automate changes to your database.
Flyway: A command-line tool. With JVM, it also provides Java API, Maven plugin and Gradle plugin. A simple graphical user interface (GUI) called Flyway Desktop is available for SQL Server, PostgreSQL and MySQL.
Liquibase: A command-line tool. A simple graphical user interface (GUI) called Liquibase Hub is available with the Pro Plan, but it has sunset in May 2023.
- Flyway: 22 SQL databases - MySQL, PostgreSQL, IBM DB2, MS SQL Server, Oracle, PostgreSQL, MySQL, Snowflake ...
- Liquibase: 50 SQL and NoSQL databases - IBM DB2, MS SQL Server, Oracle, PostgreSQL, MySQL, Snowflake, MongoDB, Clickhouse ...
Flyway: Java-based tool, so you need to install a Java Virtual Machine (JVM) before users can install Flyway.
Liquibase: Java-based tool, so you need to install a Java Virtual Machine (JVM) before users can install Liquibase.
- Flyway: CLI or GitOps. Users write SQL files and then run command
- Liquibase: CLI or GitOps. Users specify the changes by defining a
changelogand then run a command.
- Flyway: Number the SQL files in the order you want them to be executed.
- Liquibase: Specify the order of changes in the changelog file.
Database GitOps configuration
Flyway: Configure with VCS CI/CD workflow manually.
Liquibase: Configure with VCS CI/CD workflow manually.
SQL auto check
SQL auto check helps developers write less buggy SQL and save DBAs manual review efforts.
- Flyway: Code Analysis
- Liquibase: SQL Quality check
- Flyway: Only in Team Plan or above
- Liquibase: Only in Pro Plan and above
Number of rules
- Flyway: 10+ general rules or integrate a python app called SQLFluff to get more rules.
- Liquibase: 10 general rules
How to configure
Flyway: Predefined, users may set them active or not.
Liquibase: Predefined, users may set levels while calling.
How to trigger
flyway check -code ....command to produce a report.
checkcommand or manually integrate this command in automation. Users may go to admin console to view logs.
- Flyway: Run
flyway infoto show
- Liquibase: Simple Database Change Logs.
- Flyway: Via the flyway desktop, there is a way to generate a migration script to bring the target database schema in sync with the one you already created (usually dev).
- Liquibase: Support
diff-changelogto compare databases and to create a deployable changelog to sync.
- Flyway: Write rollback scripts manually. Supported in Team version.
- Liquibase: Support
Schema drift detection
- Flyway: Run
flyway check -drift ...to produce a report indicating difference between target database and the one created by the migrations applied by Flyway.
- Liquibase: Run
liquibase diff --format=jsonto produce a report indicating difference between target database and source database.
Flyway and Liquibase are the two well-established tools for database CI/CD. They are similar in many ways, both are Java based, adopt migration-based approach. The most signicant difference is Liquibase has an additional Changelog concept to allow user to specify explicit migration ordering, precondtions, labels and context, while Flyway relies on the file naming to determine the order.
Both tools provides a git like pattern for database migrations. On the other hand, if you are looking for a GitHub/GitLab experience with a nice GUI and team collaboration features, please check out our own Bytebase and continue reading the side-by-side comparison with each of them: