Easily Manage Yugabyte Database Schema Changes with Liquibase

August 12, 2021
Easily Manage Yugabyte Database Schema Changes with Liquibase

Nowadays, we have a lot of choices for where and how we run our databases. The thing is, no matter where or how we are running the database, we will always have to manage modifications to our schemas. That is just part of the natural evolution of databases as they respond to application requirements and the business needs that drive them. Liquibase and our partners know that making the process of managing schema changes quick, easy, and predictable is core to keeping our users productive and successful.

This post is about some recent developments happening with our partner Yugabyte. With their new offerings, they have been working with Liquibase to make sure that our shared community can make the most of both tools.

YugabyteDB

If you’re not familiar with Yugabyte, it is a distributed SQL database for transactional (OLTP) applications. It is 100% open source, available under the Apache 2.0 license. YugabyteDB is feature compatible with Postgres and combines enterprise-grade relational database capabilities with the horizontal scalability and resilience of cloud-native architectures.

You can download and install YugabyteDB in any environment. Alternately, Yugabyte Cloud is a fully managed database-as-a-service (DBaaS) for YugabyteDB. You can get a resilient, scalable, PostgreSQL-compatible database for your applications in just a few minutes. Yugabyte will take care of infrastructure and database operations, letting you focus on building applications.

Liquibase and YugabyteDB

As mentioned, wherever you are running Yugabyte, you have to tend to your schemas. To that end, YugabyteDB has recently improved compatibility with Liquibase so users can take advantage of faster and easier schema migrations. Specifically, there is now an enhanced Liquibase Extension for YugabyteDB. This bespoke extension makes it easy for YugabyteDB users to exploit Liquibase Change Types and other advanced features. The team used the Liquibase Test Harness to verify the functionality of the extension, so it is as solid and reliable as possible for YugabyteDB Liquibase users. 

Using Liquibase enables Yugabyte users to gain the benefits of DevOps practices: 

  • Working in Small Batches — Many smaller groups of changes are better than one big group.
  • Versioning Everything – Transparency, predictability, and situational awareness for everyone.
  • Automating Everything – Repeatability and speed.
  • Testing Everything – Test the whole stack, including the automated process that delivers the changes.
  • Shifting Left – Ensuring changes are correct as early as possible in the delivery flow.

Connecting Liquibase to Yugabyte Cloud 

Connecting Liquibase to the Yugabyte Cloud is a pretty easy thing to do using the same instructions from the Liquibase Tutorial for YugabyteDB and simply substituting the correct settings for your cloud instance.

  1. Go out to the Yugabyte Cloud Beta and get a free test cluster.
  1. Using the information from the Connect menu at the top, set up Liquibase to talk to the Yugabyte Cloud cluster. Since I am using Liquibase Pro, I can skip the .properties file or very long command line and simply set everything up using environment variables.
  1. Run Liquibase commands against the Yugabyte Cloud cluster. I will start with liquibase status and a single changeset. This command will connect to the database, but will not make any changes.
  1. With connectivity proven, I can now run liquibase update to deploy the changeset to the Yugabyte Cloud cluster.
  1. And, of course, I can track operations in Liquibase Hub so I can collaborate easier with my team.

Resources 

Here are the resources used in the example:

Article author
Dan Zentgraf Director of Solution Architecture