I believe that there is no need for describing why the usage of database migration tools is vital for modern days apps that utilize relational database engines. I will only say that they can make our life much easier and help us to automatize a complex and repetitive process. Through the course of this article, I will provide some more insights into similarities and differences between two of the most common open-source migration tools, namely Flyway and Liquibase. I will start with quick descriptions of both tools.

Flyway

It is described by its creators, a company called Redgate, as an open-source database migration tool that prefers simplicity and convention over configuration. As of now, it supports most of the currently used database engines, such as Postgres, Oracle, SQL Server, DB2, H2, MariaDB, and many others. It also supports some cloud base database services like Amazon RDS or Google Cloud SQL or Heroku. The script can be written in pure SQL (many dialects are supported) or in Java (mostly for more complex transformations). It has a command line client but it also provides Maven and Gradle plugins. What is more, it has Java API which also works for Android. For those of you who use .NET and C#, there is a Flyway counterpart named Evolve so if you are interested you can check this one up. The link to its GitHub page will be at the end of the article.

Liquibase

It started in 2006 and is an open-source tool for database migrations. It is based on the concept ofchangelogsandchangesetsfiles which can be written in SQL, XML, YAML, JSON. There we store all the changes which we want to make in our database structure. These files can be further used to apply those changes to any other database instance. Liquibase supports subsequent databases: Postgres, Oracle, DB2, H2, MariaDB, SQL Server, SQLite, and many others. Many cloud-based databases are also supported for example Azure SQL, Amazon RDS, Amazon Aurora. You can run Liquibase migration scripts from shell, using build tools such as Maven Gradle or even Ant. Moreover, you can generate pure SQL queries that can be further executed by your DBA-s/Ops/DevOps team or anyone who is taking care of your database.

Now that we described both tools, we can move to describing similarities and differences between them. Let’s start with the similarities between these two tools.

Similarities

  • Both are to some degree open source and provide some part of features for free but also have paid versions that provide more features.
  • Both can use plain old SQL to write your migration scripts.
  • Both are strongly “Java oriented” and also have built in support for basic build tools like Maven or Gradle as well as integration with the most common Java frameworks, for example: Spring Boot.
  • Both can be run as simple shell scripts from command line.
  • The list of supported databases is more or less similar. There can be some minor differences in supported versions or drivers but in general, there are no easily visible differences between them in this area.
  • Both are based on the same approach for handling database changes, namely Migration Based Database Delivery.
  • Both tools try to implement the concept of **Evolutionary database **presented and explained by Martin Fowler (link in the end of the article).

#tools #database #integration #migration #opensource #comparison #discussion #liquibase #flyway

Flyway vs Liquibase
1.45 GEEK