Using Liquibase with YugabyteDB

YugabyteDB is an open-source, high-performance, distributed SQL database for global, internet-scale apps. It can be run on your local machine as well as a cloud cluster.

Note: For more information, see the YugabyteDB documentation page.

Supported Versions

  • 2.6

Note: The supported versions are the versions that were tested with Liquibase Test Harness.


Before using Liquibase and YugabyteDB, ensure you have completed the following:

Driver Information

To use Liquibase and YugabyteDB, you need to have the JDBC jar file:

  1. Ensure you have downloaded the PostgreSQL JDBC jar driver file to connect to YugabyteDB.
  2. Place your postgresql-version.jar file in the liquibase/lib directory.

Note: If you put the postgresql-version.jar file in any other directory, specify the path to it in the file: classpath:../path_to_drivers/postgresql-version.jar. For more information, see Creating and configuring a file.

If you use Maven, you can alternatively download the PostgreSQL JDBC driver and put the driver in a location that your Maven build can access. Configure the Maven pom.xml file to use the local copy of the driver jar file. For example:


Testing Your Connection

  1. Ensure your YugabyteDB is configured. You can check its status depending on your cluster setup. Run the yugabyted command:

    ./bin/yugabyted status
  2. Specify the database URL in your file:


    When using the YugabyteDB on-premises and specifying the URL, enter your IP address or host name, the port, and the database name. An example of the format is:

    jdbc:postgresql://<IP OR HOSTNAME>:<PORT>/<DATABASE>

    The default username and password is yugabyte for both. Add those to the file:

    url: jdbc:postgresql://localhost:5433/yugabyte
    username: yugabyte
    password: yugabyte
  3. Create a text file called Working with Changelogs (.xml, .sql, .json, or .yaml) in your project directory and add a Changelog Formats :
  1. Run the status command to see whether the connection is successful. Specify the name of the changelog you created in place of changelog.xml. Also, to run Liquibase commands, you need to specify your username and password in the file or on the command line. However, the username and password attributes are not required for connections and systems which use alternate means of authentication.

    liquibase --username=yugabyte --password=yugabyte --changeLogFile=changelog.xml status

    Note: Alternatively, you can add the changeLogFile attribute to your file.

  1. Run your first update with the Liquibase update command, which will make changes to your database. You can also run the updateSQL command if you want to inspect the SQL before running the update command.

    liquibase --changeLogFile=changelog.xml updateSQL
    liquibase --changeLogFile=changelog.xml update

After your first update, your database will contain the table you added along with the DATABASECHANGELOG and DATABASECHANGELOGLOCK tables:

  • DATABASECHANGELOG table. This table keeps a record of all the changesets that were deployed. When you deploy, the changesets in the changelog are compared with the DATABASECHANGELOG tracking table, and only the new changesets that were not found in the DATABASECHANGELOG will be deployed.
  • DATABASECHANGELOGLOCK table. This table is used internally by Liquibase to manage access to the DATABASECHANGELOG table during deployment and ensure only one instance of Liquibase is updating the database at a time, whether that is creating, updating, or deleting changes.

Supported Commands and Change Types

Change Type Supported Command Supported
addAutoIncrement Supported calculateCheckSum Supported
addCheckConstraint Pro changeset changelogSync Supported
addColumn Supported changelogSyncSQL Supported
addDefaultValue Supported changelogSyncToTag Supported
addForeignKeyConstraint Supported changelogSyncToTagSQL Supported
addLookupTable Supported clearCheckSums Supported
addNotNullConstraint Supported dbDoc Supported
addPrimaryKey Supported deactivateChangeLog Supported
addUniqueConstraint Not supported diff Supported
alterSequence Not supported diff JSON Supported
createFunction Pro changeset diffChangeLog Supported
createIndex Supported dropAll Supported
createPackage Pro changeset futureRollbackCountSQL Supported
createPackageBody Pro changeset future-rollback-from-tag-sql Supported
createProcedure Supported futureRollbackSQL Supported
createSequence Supported generateChangeLog Supported
createSynonym Pro changeset help Supported
createTable Supported history Supported
createTrigger Pro changeset listLocks Supported
createView Supported markNextChangeSetRan Supported
customChange Supported markNextChangeSetRanSQL Supported
delete Supported registerChangeLog Supported
disableCheckConstraint Pro changeset releaseLocks Supported
disableTrigger Pro changeset rollback Supported
dropAllForeignKeyConstraints Supported rollbackCount Supported
dropCheckConstraint Pro changeset rollbackCountSQL Supported
dropColumn Supported rollbackOneChangeSet Pro command
dropDefaultValue Supported rollbackOneChangeSetSQL Pro command
dropForeignKeyConstraint Supported rollbackOneUpdate Pro command
dropFunction Pro changeset rollbackOneUpdateSQL Pro command
dropIndex Supported rollbackSQL Supported
dropNotNullConstraint Supported rollbackToDate Supported
dropPackage Pro changeset rollbackToDateSQL Supported
dropPackageBody Pro changeset snapshot Supported
dropPrimaryKey Pro changeset snapshotReference Supported
dropProcedure Supported status --verbose Supported
dropSequence Supported syncHub Supported
dropSynonym Pro changeset tag command Supported
dropTable Supported tagExists Supported
dropTrigger Pro changeset unexpectedChangeSets Supported
dropUniqueConstraint Not supported update Supported
dropView Supported updateSQL Supported
empty Supported updateCount Supported
enableCheckConstraint Pro changeset updateCountSQL Supported
enableTrigger Pro changeset updateTestingRollback Supported
executeCommand Supported updateToTag Supported
insert Supported updateToTagSQL Supported
loadData Supported validate Supported
loadUpdateData Supported    
markUnused Pro changeset    
mergeColumns Supported    
modifyDataType Supported    
output Supported    
renameColumn Supported    
renameSequence Not supported    
renameTable Supported    
renameTrigger Pro changeset    
renameView Supported    
setColumnRemarks Supported    
setTableRemarks Supported    
sql Supported    
sqlFile Supported    
stop Supported    
tagDatabase Supported    
update Supported