Skip to content

evantill/liquibase-utils

Repository files navigation

Liquibase Utils

Build Status Maven Central Coverage Status

Liquibase Utils is an extension to Liquibase to add common utilities like preconditions

Preconditions

contextDefined

   <preConditions>
      <utils:contextDefined/>
   </preConditions>

contextMatch

   <preConditions>
      <utils:contextMatch expression="(a and b) or !c"/>
   </preConditions>

Installation

Quick start

In order to use this extension, you must have the liquibase-utils.jar jar in your classpath.

For XML change logs, define the utils namespace as below:

<?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:utils="http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-utils"
   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/liquibase-utils 
                        https://evantill.github.io/liquibase-utils/liquibase-utils-0.2.xsd">
</databaseChangeLog>

Using the XML elements defined by this extension requires specifying the utils namespace prefix on those elements. Here is a quick example of how to require a context:

   <preConditions>
      <utils:contextDefined/>
   </preConditions>

Refer to the documentation for further information.