Get your free Liquibase Fundamentals Certification!

Once you have run your first update, you can go through the entire developer workflow from beginning to end.

Add new changesets to the changelog

On your local development machine, add new changeset(s) to your changelog.

Apply changes to the developer database

Run liquibase update to apply the changes to the developer database. Iterate until you are happy with the final state.

Understand database changes before saving and applying them

It is always best practice to understand the changes BEFORE saving and applying them to the changelog… especially if someone else edited or created the changelog.

Running the following command to see if there are changesets that have no been applied to the integration database:

liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration status --verbose

Check your SQL

Run the following command to check the SQL before applying updates:

liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration updateSQL

You can also run a diff command to compare the changes before saving and applying them:

liquibase --referenceUrl=jdbc:h2:tcp://localhost:9090/mem:integration --referenceUsername dbuser --referencePassword letmein diff

Save to source control

Save your changelog to source control when you are happy with the changes that will be applied.

Apply the new changesets

Apply the new changesets:

liquibase --url=jdbc:h2:tcp://localhost:9090/mem:integration update

To see that all changes have been applied to the integrations database, rerun the following commands:

  • status
  • updatedSql
  • diff

Keep going

Now that you have a feel for Liquibase against your sample database, you can try it against your standard databases.

Just add your database’s jdbc drivers to the lib directory in the Liquibase install directory and update the url, username, and password fields in the file.

Also, check the documentation associated with your specific database to locate the correct URL format and download the driver jar. Then, use the Liquibase developer workflow to make changes against your own database.