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 keep it simple, you can write migrations in SQL – a database-specific syntax supported for PL/SQL. To take advantage of abstraction abilities, use a database-agnostic way by specifying your 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 Type, 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 6 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:

Related links