Explanation

Flyway (Redgate) vs. Liquibase: a side-by-side comparison for database schema migration

Changyu
Changyu9 min read
Flyway (Redgate) vs. Liquibase: a side-by-side comparison for database schema migration

When looking for a database CI/CD and schema migration change tool, Flyway (Redgate) 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

  • Java-based, providing Java SDK and CLI.
  • Provide open-source community version and closed-source commercial version.
  • 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. star-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.

FlywayLiquibase
Product positionSchema Change & Version ControlSchema Change & Version Control
Developer interfaceCLICLI
Supported databases22 Only SQL50 SQL & NoSQL DB
Programming language and installationJava + JVMJava + JVM
Change executionSQL script + CLIChangelog (XML) + CLI
Change orderNumbering of SQL filesChangelog (XML)
Database GitOpsβœ…βœ…
SQL auto checkβœ…βœ…
Change historyβœ…βœ…
Sync schemaβœ…βœ…
Rollbackβœ…βœ…
Schema drift detectionβœ…βœ…

Product position

  • Flyway: A database schema change and version control tool. flyway-position

  • Liquibase: A database schema change and version control tool. It helps you track, manage, and automate changes to your database. liquibase-position

Developer interface

  • 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.

Supported databases

  • 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 ...

Installation

  • 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.

Change execution

  • Flyway: CLI or GitOps. Users write SQL files and then run command flyway migrate.

flyway-change

  • Liquibase: CLI or GitOps. Users specify the changes by defining a changelog and then run a command.

liquibase-changelog liquibase-update

Change order

  • Flyway: Number the SQL files in the order you want them to be executed. liquibase-change-order
  • Liquibase: Specify the order of changes in the changelog file. liquibase-change-order

Database GitOps configuration

  • Flyway: Configure with VCS CI/CD workflow manually.

  • Liquibase: Configure with VCS CI/CD workflow manually. flyway-ci-cd liquibase-gitlab-gitops

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

Supported plan

  • 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. flyway-code-analysis-rules

  • Liquibase: Predefined, users may set levels while calling. liquibase-quality-check

How to trigger

  • Flyway: Run flyway check -code .... command to produce a report. flyway-check-code flyway-code-analysis-report

  • Liquibase: Run check command or manually integrate this command in automation. Users may go to admin console to view logs. liquibase-validate-result

Change history

  • Flyway: Run flyway info to show flyway_schema_history table. flyway-info
  • Liquibase: Simple Database Change Logs. liquibase-logs

Sync schema

  • 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). flyway-sync-schema
  • Liquibase: Support diff-changelog to compare databases and to create a deployable changelog to sync.

Rollback

  • Flyway: Write rollback scripts manually. Supported in Team version.
  • Liquibase: Support rollback-one-changeset or rollback.

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=json to produce a report indicating difference between target database and source database.

Summary

Flyway and Liquibase are the two well-established tools for database CI/CD. They are similar in many ways, both are Java based, provide and only provide Java SDK and CLI, without GUI and API, adopt migration-based schema migration, and use the same open-source monetization strategy.

The most significant difference is Liquibase has an additional Changelog concept to allow user to specify explicit migration ordering, preconditions, labels and context, while Flyway relies on the file naming to determine the order.

Both tools provide a git-like experience 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:

Jointhe community

At Bytebase, we believe in the power of collaboration and open communication, and we have a number of communities that you can join to connect with other like-minded.

Subscribe toΒ Newsletter

By subscribing, you agree with Bytebase's Terms of Service and Privacy Policy.