Liquibase VS Flyway (2024)
Flyway
Flyway now supports the majority of popular database engines, including Postgres, Oracle, SQL Server, DB2, H2, MariaDB, and many others. It also supports Amazon RDS, Google Cloud SQL, and Heroku, which are all cloud-based database providers.
The script can be written in either pure SQL or Java (several languages are supported) (mostly for more complex transformations). It includes a command-line client as well as Maven and Gradle plugins.
It also offers a Java API that works on Android.
If you use.NET and C#, there is a Flyway counterpart called Evolve (GitHub page).
Flyway Java base migration
Refer Spring Boot + Flyway Example.
Flyway Command Line base migration
Refer example for Flyway Command Line base migration.
Liquibase
It's an open-source database migration tool. It is built around the concept of changelogs and changesets, which can be expressed in SQL, XML, YAML, and JSON. We keep all of the changes we wish to make to our database structure there. These files can then be used to replicate the modifications across several database instances.
Postgres, Oracle, DB2, H2, MariaDB, SQL Server, SQLite, and many other databases are supported by Liquibase. Many cloud-based databases, such as Azure SQL, Amazon RDS, and Amazon Aurora, are also supported.
You could use build tools like Maven, Gradle, or even Ant to run Liquibase migration scripts from the command line. Furthermore, you may create pure SQL queries that can be run by your DBAs, Ops/DevOps team.
Refer Spring Boot + Liquibase Example.
Similarities between Flyway and Liquibase
- To make database changes, it uses a migrations-based strategy.
- At update time, both tools verify if a modifications has already been deployed
- Both uses Maven or the command line
- As a premium add-on to their open source offering, both provide extra support and features.
- Both could use plain old SQL for doing Migrations based on SQL.
- Both could do rerunnable vs. non-rerunnable changes for Repeatable migrations.
- Both are based on Martin Fowler's Evolutionary Database.
Differences between Flyway and Liquibase
FlywayDB |
Liquibase |
|
Diff utility to compare two databases | No | Yes |
Generates SQL for you | Yes | No |
Rollback | Paid Service | Yes, available |
Targeted rollback for any single change and Targeted rollback for a set of changes | No | Paid Service |
Ability to manage change files in a variety of ways and can use the monitoring and reporting dashboard. | No | Yes |
Specifying changes file | SQL | SQL, XML, JSON, YAML |
Repeatable migrations | Yes | Yes |
Dry runs | Paid Service | Yes, available |
Preconditions | No | Yes |
Selective deployments | Many Files | One File |
Manage the order of changes | Hard | Easy |
Ability to work with stored logic | No | Yes |
Flexibility in how change files are managed | No | Yes |
Monitoring & reporting dashboard to view and organize changes | No | Yes |