Introduction to Liquibase

Liquibase is a database schema change management solution that enables you to revise and release database changes faster and safer from development to production.

Tip: Check out Why Liquibase? for more information.

To start using Liquibase quickly and easily, you can write your migration scripts in SQL.

To take advantage of database abstraction abilities that allow you to write changes once and deploy to different database platforms, you can specify database-agnostic changes in XML, JSON, or YAML.

Changelog organization

Liquibase uses SQL, XML, JSON, and YAML changelog files to list database changes in sequential order. Database changes have the format of changesets. Changesets contain Change Types, which are types of operations to apply to the database, such as adding a column or primary key. Context, label, and precondition changelog tags help precisely control when a database change is made and to which database environment it is deployed.

Liquibase properties file

To set the connection between Liquibase with your database, you need the database connection information and parameters. Liquibase includes a properties file to store database connection information and parameters that rarely change. Setting the parameters as environment variables to handle sensitive database information or running them at the command prompt is an alternative option.

Liquibase commands

Liquibase runs six basic types of commands: update, rollback, snapshot, diff, status, and utility commands. When you use the update command to deploy your first changes, Liquibase checks the database connection information, including credentials, database URL, and JDBC driver.

Database Changelog and Database Changelog Lock

When you deploy your changes, Liquibase creates two tables in your database: DATABASECHANGELOG and DATABASECHANGELOGLOCK.

The DATABASECHANGELOG table tracks deployed changes so that you have a record. Liquibase compares the changesets in the changelog file with the DATABASECHANGELOG tracking table and deploys only new changesets.

DATABASECHANGELOGLOCK prevents multiple instances of Liquibase from updating the database at the same time. The table manages access to the DATABASECHANGELOG table during deployment and ensures only one instance of Liquibase is updating the database.

Database management options

Liquibase offers many ways to manage your database changes:

Get started now!

To get started with Liquibase, follow these steps:

  1. Install Liquibase – Download Liquibase on your machine
  2. Get Started with Liquibase – Learn how to use Liquibase with an example database
  3. Design Your Liquibase Project – Create a new Liquibase project folder and organize your changelogs
  4. Liquibase Database Tutorials – Configure Liquibase to work with your own database
  5. Best Practices – Read about best practices to follow with Liquibase