Get your free Liquibase Fundamentals Certification!

Here’s how Liquibase can help your team deliver database changes faster, easier, and safer.

<changeSet author=”Bob” id=”157”>
  <createTable tableName=”person”>
    <column autoIncrement=”true” name =”id” type=”INTEGER”>
      <constraints> nullable=”false” primaryKey=”true” primaryKeyName=”person_pkey”/>
    </column>
    <column name=”firstname” type=”VARCHAR(50)”/>
    <column name=”lastname” type=”VARCHAR(50)”>
      <constraints nullable=”false”/>
    </column>
    <column name=”state” type=”CHAR(2)”/>
    <column name=”username” type=”VARCHAR(8)”/>
    <column name=”column1” type=”VARCHAR(8)”/>
    <column name=”column2” type=”VARCHAR(8)”/>
  </createTable>
</changeSet>

 

Define database changes

Liquibase makes it easy to define database changes in a format that’s familiar and comfortable to each user and then automatically generates database-specific SQL for you. Liquibase uses changesets to represent a single change to your database. Here’s an example of a changeset to create a table. 

<changeSet author=”Bob” id=”157”>
  <createTable tableName=”person”>
    <column autoIncrement=”true” name =”id” type=”INTEGER”>
      <constraints> nullable=”false” primaryKey=”true” primaryKeyName=”person_pkey”/>
    </column>
    <column name=”firstname” type=”VARCHAR(50)”/>
    <column name=”lastname” type=”VARCHAR(50)”>
      <constraints nullable=”false”/>
    </column>
    <column name=”state” type=”CHAR(2)”/>
    <column name=”username” type=”VARCHAR(8)”/>
    <column name=”column1” type=”VARCHAR(8)”/>
    <column name=”column2” type=”VARCHAR(8)”/>
  </createTable>
</changeSet>

 

Update and manage the same schema across multiple types of database

Liquibase allows you to specify the database change you want using SQL or several different database-agnostic formats, including XML, YAML, and JSON. Developers can abstract the database code to make it extremely easy to push out changes to different database types. The abstract format options also offer more flexibility and many more features over a formatted SQL changelog.

changelog is applied to multiple database types
<?xml version="1.0" encoding="UTF-8"?>  
<databaseChangeLog  
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"  
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"  
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
    http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd ">  
</databaseChangeLog>

 

Easily add new changes and reorder them

Database changes are managed with one ledger that we call the changelog. Liquibase tracks which changesets have or have not been deployed in a tracking table (DATABASECHANGELOG).

Liquibase uses a unique identification scheme: an ID and author, along with the name and path of the file all in a changelog. This makes it easy to manage and reorder database changes. Since there are multiple factors that drive the uniqueness of a given change, it also reduces developer conflicts and collisions.

<?xml version="1.0" encoding="UTF-8"?>  
<databaseChangeLog  
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"  
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"  
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
    http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd ">  
</databaseChangeLog>

 

Track, version, and deploy database changes

Changelogs and tracking tables allow Liquibase to help teams track and version database changes and deploy changes.

  • Track and version database changes
    Developers know which changes have been deployed to the database and which changes have not yet been deployed.
  • Deploy changes
    Liquibase compares the changelog against the tracking table and only deploys changes that have not been deployed to the database.
liquibase tracking table
target icon

Rollbacks included

Even the free, open-source version of Liquibase allows you to undo changes you have made to your database, either automatically or via custom rollback SQL with the rollback command. Liquibase Pro adds Targeted Rollbacks, which allow users to rollback a specific change or set of changes without rolling everything else back, saving a lot of time and headaches.

target icon

Selectively deploy changes to different environments

If your use case requires you to selectively deploy changes, Liquibase is a perfect solution. Since Liquibase uses one ledger (changelog), it’s very straightforward to add labels and contexts to ensure that your deployments are defined in one place.

<changeSet  id="2"  author="bob"  context="test">  
     <insert  tableName="news">  
         <column  name="id"  value="1"/>  
         <column  name="title"  value="Liquibase 0.8 Released"/>  
     </insert>  
     <insert  tableName="news">  
         <column  name="id"  value="2"/>  
         <column  name="title"  value="Liquibase 0.9 Released"/>  
     </insert>  
 </changeSet>

 

capture logic icon

Work with stored logic

Liquibase Pro enables users to snapshot and work with stored logic. Snapshots allow you to get a static view of your database at a particular point in time and is useful for reporting and safeguarding your data by comparing databases (performing diffs) to find differences.

capture logic icon

Visualize changes

From Liquibase Community to Liquibase Enterprise, each one of our products provides a dashboard with insights into your database changes.

  • Liquibase Hub is our free SaaS tool designed for our open-source and Liquibase Pro users.
  • Liquibase DMC is our on-prem dashboard and reporting tool designed for our Liquibase Business and Liquibase Enterprise users.
dashboard icon

Package code and automate

Package your SQL scripts and test the corresponding rollback scripts at the same time. Liquibase Enterprise validates the SQL scripts as well as the rollback scripts. If the rollbacks fail to revert the database back to its original state, then the build fails, and you’re alerted. The Liquibase command returns an error that you’ll see on the command line. Instant feedback loop!

Enforce rules

Automate reviews of routine database changes. Liquibase Enterprise comes with a large library to use and checks the following:

  • Basic style (e.g., naming conventions, no prohibited statements such as “GRANT”, etc.)
  • Impact of changes on database structure (e.g., tables must have primary key/constraint, all foreign keys have indexes, no circular VIEW logic, etc.)

Plus, teams can add and customize rules so that you can include best practices from your DBAs.

compliance icon
forecast icon

Forecast changes and eliminate failed deployments

Forecast the impact of changes on a target database in any environment. Take the risk out of deployment! Liquibase Enterprise checks to ensure that nothing has changed in the target database that would cause changes that worked in a lower environment to fail in the target environment.

Never hear “it worked in Test but failed in Stage” ever again.

forecast icon