Liquibase for DBAs

June 4, 2016

The role of the Database Administrator is evolving and has never been more complex. DBAs are constantly juggling schema management, performance tuning, change control, plus database administration all within ever-shortening application development cycles. On top of all that, there are more database environments to manage than ever before, more distributed sources of database changes, and more stringent compliance requirements.

It is easy for database changes to get lost or misapplied along the way and far too often the place where problems are found is in production. Fortunately, Liquibase can bring a sense of control to the database deployment process while still giving DBAs the control they need. In addition Liquibase works alongside the database professionals preferred toolset.

No change is forgotten

Liquibase tracks which changelog statements have run against each database, so DBAs no longer have to manually track which SQL statements have been run and which have not.

Like SQL? Use SQL

XML-formatted changelogs have their advantages, but many DBAs still prefer good old-fashioned SQL. If that is what the team is most comfortable working with, Liquibase-formatted SQL provides the standard changeSet tracking used in any changelog format but lets the DBA specify the exact SQL you want.

Manually verify the database changes with each release

Liquibase supports an “updateSql” command that will not actually update the database, but instead output the SQL that will run. That script can be read and verified to ensure everything is correct and performing as expected.

Once everything is correct, DBAs can either run a Liquibase update or run the script through their favorite tools. The script will include the DATABASECHANGELOG inserts so everything will still be correctly tracked.

Prepare for deployment problems

Releases don’t always go as planned, so Liquibase ensures contingency plans are correct before each release. As teams get closer to releasing new application updates, besides checking the updateSql output, DBAs can also run futureRollbackSql which will output the SQL needed to bring a fully updated database back to the current state. It will be much less stressful verifying the rollback logic BEFORE the release.

A unified changelog for all your databases

DBAs try to keep all databases the same, but there are always differences. QA needs test data, production gets a couple extra tables, and the hot-backup server needs extra configuration. Liquibase supports contexts, labels, parameters, and preconditions that let database professionals address minor differences in scripts to adjust things as needed.

  • Contexts and labels target certain changeSets to run in only some environments.
  • Parameters perform simple text substitutions when things like schema names vary from database to database.
  • Preconditions check the state of the database to dynamically determine if a changeSet should be executed or not.

Thanks to Liquibase’s cross-database support, DBAs can even use a single changelog that supports Oracle, MS SqlServer, Postgresql, and more.

Article author
Nathan Voxland