Liquibase Enterprise was formerly known as Datical DB.

Packaging Liquibase Changelogs

Packaging Liquibase changelogs is a separate process from packaging SQL files. They may be placed only in flexible folders. There is no fixed-folder name or processing for Liquibase changelogs.

Changelog File Requirements

Place the changelog files in a folder in your sql_code repository. 

  • Must be in a separate folder from SQL folders
  • The folder itself can be named anything you want. The folder name changelog is used in examples.
  • The files must consist of only complete changelogs. 
  • The file must have an author. 
  • Changesets must have globally unique IDs 

Changelog Content Restrictions

The changesets in changelog files may not include the following

  • External file references
  • Liquibase preconditions
  • Liquibase extensions

Sample

Here is a sample changelog file (filename: employee.xml)

<?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"  
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">  

    <changeSet  id="157"  author="bob">  
        <createTable  tableName="employee">  
            <column  name="id"  type="int">  
                <constraints  primaryKey="true"  nullable="false"/>  
            </column>  
            <column  name="name"  type="varchar(50)">  
                <constraints  nullable="false"/>  
            </column>  
            <column  name="active"  type="boolean"  defaultValueBoolean="true"/>  
        </createTable>  
    </changeSet>  

</databaseChangeLog>

Properties for Changelogs

The following properties in metadata.properties must be set in a folder that contains only changelogs. 

  • packageMethod=changelog
  • rerunnable=false

Processing halts and reports errors if these conditions are not met. 

In addition to these properties, other properties are also supported as documented here: Using the metadata.properties file

Processing

During processing, the Liquibase changesets are transformed to Datical changesets. 

Properties Set

The following attributes are added and set for the changelog and its changesets. 

  • datical:version (initially 1)
  • datical:versionStrategy (DEPLOY_ALL)
  • datical:origFilePath
  • datical:origFileName

Additional properties are set during processing:

  • Labels and contexts set in metadata.properties
  • Commit messages from source control

File Handling

The changelog XML files are copied to the Resources folder for the project. 

After processing, the changelog XML files are moved to the Archive folder for the project. 

Developer Workflows

You can package developer workflow scripts alongside the original changelog to manage workflow for its packaged changesets. 

Supported

  • Ignore - add a an ignore file to prevent the packaged changesets from being deployed.

    <original-filename>-ignore.xml
  • Cleanup - add an XML changelog to reverse database changes caused by packaging a changelog. The cleanup changelog must account for all changes made by the original changelog. 

    <original-filename>-cleanup.xml
  • Replace - add a replacement changelog to replace the original changelog.

    <original-filename>-replace.xml

Not Supported

  • Rollback - do not add a rollback file for Liquibase changelog. If a rollback file is found, packaging stops and exits with an error. 

See Developer Workflows: Managing Changesets During Development and Test

Copyright © Liquibase 2012-2022 - Proprietary and Confidential