Flyway vs Liquibase

Reading Time: 2 minutes

Introduction

There are two open source-based tools for database version control Liquibase and Flyway. These are popular options for organizing database changes and database versioning, deploying changes when they need to be deployed, and tracking what’s been deployed. Those who have ever developed any software will tell you, you shouldn’t develop application code without version control and also same is true for database code.

So, acknowledge the differences and similarities between these two database change migration tools so you can decide which one will work best for your use case, team structure, and workflow.

Here in this blog, we will study the similarities and differences between Liquibase and Flyway.

Liquibase

It’s an open-source database migration tool that is built around the concept of changelogs and changesets, which can be expressed in SQL, XML, YAML, and JSON. Remain all of the changes we wish to make to our database structure there. Those files can then be used to replicate the modifications across several database instances. It follows a different concept to implement database refactoring.

As of now, Liquibase supports most of the popular databases including MySQL, Oracle, DB2, and PostgreSQL.

Flyway

It is an open-source tool, licensed under Apache License 2.0, that helps you implement automated and version-based database migrations that allow you to define the required update operations in an SQL script or as Java code. We can then run the migration from a command line client or automatically as part of your build process or integrated into your Java application.

A different feature of Flyway is that you can provide migration scripts not only in SQL format but also as Java code. In this way, you can implement complex and dynamic database migrations. 

Similarities Between Liquibase and Flyway

Liquibase and Flyway implement the design principles of the progressive database they have a lot of similar functionality.

  • These are open-source to an extent and help manage and track and deploy database schema changes.
  • Both use a versioned migration approach to a database schema change.
  • Are based on Java and provide extensive support for Java frameworks like Spring Boot and Vert. x.
  • Both Support integration with build tools like Maven and Gradle.
  • These can run independently from the command line through provided scripts.
  • Support a wide variety of databases.

Differences between Flyway and Liquibase

FlywayLiquibase
Diff utility to compare two databasesNoYes
Generates SQL for youYesNo
RollbackPaid ServiceYes, available
Targeted rollback for any single change and Targeted rollback for a set of changesNoPaid Service
Ability to manage change files in a variety of ways and can use the monitoring and reporting dashboard.NoYes
Specifying changes fileSQLSQL, XML, JSON, YAML
Repeatable migrationsYesYes
Dry runsPaid ServiceYes, available
PreconditionsNoYes
Selective deploymentsMany FilesOne File
Manage the order of changesHardEasy
Ability to work with stored logicNoYes
Flexibility in how change files are managedNoYes

Conclusion

In this blog, we compared two of the most used database migration tools Liquibase and Flyway. There are always trades to make when choosing between tools. Both Flyway and Liquibase support all features that you need for professional database refactoring and versioning, Flyway uses SQL to define database changes. On the other with Liquibase, you can introduce an abstraction layer by using XML, YAML, or JSON to define your database changes. Thus, Liquibase is better suited and flexible, covering more database change and deployment use cases than Flyway.

Written by 

Deepak kumar is a Software Intern at Knoldus Inc. He has done Post Graduation from Ajay Kumar Garg Engineering College Ghaziabad. He has the knowledge of various programming languages. He is passionate about Java development and curious to learn Java Technologies. He is a quick learner, problem solver and always enjoy to help others. His hobbies playing Cricket and watching Hollywood movies.