Liquibase Enterprise was formerly known as Datical DB.

Choosing a Packaging Method

You have choices in how to arrange folders in source control and set options for how to process them. This section provides an overview of how to choose one, based on factors

  • Size and scope of SQL script
  • Frequency of SQL script changes
  • Staffing and organizational considerations (specialization) 

The packageOrderStrategy property allows you to choose from three ordering strategies (DEFAULT, PACKAGEMETHOD, ALPHANUMERIC).

See also Custom Packaging Order for more details on packageOrderStrategy and on using the folderOrder property in metadata.properties

In addition, if packaging order must be specified manually, you can use a manifest file to specify the SQL scripts to package and the order to package them in. 

Legacy (DEFAULT)

This packaging order is specified by packageOrderStrategy=DEFAULT. The legacy ordering is the packaging order within fixed folders that has been used historically in Datical DB. See Fixed Folder Names

Files are processed by the following ordering criteria:

  1. Commit time - the files in the earliest single commit are processed first, then the files in the next commit, and so on. 
  2. File type - within a commit group, files are processed in a fixed file type sequence
  3. Filename (alphabetical) - within a file type folder, files are processed in alphabetical order. 

The DEFAULT order works well for a team that writes granular SQL scripts in a Continuous Integration/Continuous Deployment process. 

  • Scripts are small (one per object is ideal)
  • Script changes are committed rapidly over time
  • The team delivers sets of changes for release in a short timeframe (weekly, monthly)

By packageMethod property (PACKAGEMETHOD)

This packaging order is specified by packageOrderStrategy=PACKAGEMETHOD. The PACKAGEMETHOD strategy works with flexible folder names. See Flexible Folder Names

  • The metadata.properties file is used with folders that you name. It provides the fileType and packageMethod properties to apply to all scripts in a folder (where the metadata.properties file is placed). 
  • The team commits SQL scripts less frequently or at irregular intervals.
  • There may be separate teams that are in charge of different types of SQL changes: DDL, DML, stored logic.  

Alphabetically (ALPHANUMERIC)

This packaging order is specified by packageOrderStrategy=ALPHANUMERIC.  When you use this packaging order, all files eligible for packaging are processed in alphabetical order only. The files to process are considered by both folder and filename: <foldername>/<filename>.

This differs from the default packaging order in important ways:

  • Commit time: Commit time does not matter. All files committed since the last packaging run are considered as a single group.
  • Folder order: Because folder is considered as part of the filename, the custom fixed folder order is not used. Instead, the folders are processed in alphabetical order.
  • Name: folder and filename are considered as one string: <foldername>/<filename>. 

Example of ALPHANUMERIC Package Order

Consider the following set of files and their commit times:

Folder/FilenameCommit Time

ddl/alpha.sql
ddl/beta.sql
ddl_direct/beta2.sql
sql_direct/eddy.sql
sql_direct/epsilon.sql
view/delta.sql

21:00
ddl/barney.sql22:00

The following table shows the packaging order of the sample set of files for the DEFAULT packaging order and the ALPHANUMERIC packaging order.  

DEFAULTALPHANUMERIC
  1. ddl/alpha.sql
  2. ddl/beta.sql
  3. ddl_direct/beta2.sql
  4. view/delta.sql
  5. sql_direct/eddy.sql
  6. sql_direct/epsilon.sql
  7. ddl/barney.sql
  1. ddl/alpha.sql
  2. ddl/barney.sql
  3. ddl/beta.sql
  4. ddl_direct/beta2.sql
  5. sql_direct/eddy.sql
  6. sql_direct/epsilon.sql
  7. view/delta.sql

Notes

  • Two commit times: ddl/barney.sql is packaged last
  • Fixed folder order: ddl, ddl_direct, view, sql_direct
  • Alphanumeric within each folder

Notes

  • Commit time is not considered, so ddl/barney.sql is packaged earlier in the sequence
  • Folder+filename order is strictly alphabetical, so view/delta.sql is packaged later in the sequence

The ALPHANUMERIC packaging order may be appropriate in the following organizational contexts:

  • There are a large number of teams, each with a smaller area of specialization 
  • The team commits SQL scripts less frequently or at irregular intervals.
  • Teams are organized according to different types of SQL changes: DDL, DML, individual stored-logic types.  

Folder Order

The folderOrder property in the metadata.properties file allows you to specify a set of selected folders in order. Files from these folders are pulled to the front of the list of files for packaging. This method is intended as an extension to be used with the PACKAGEMETHOD and ALPHANUMERIC strategies. See Custom Packaging Order

  • It must be specified in the metadata.properties file placed in the top of the SQL script hierarchy. The top folder is specified by sqlScmSQLBaseDir in deployPackager.properties.
  • Examples of how it could be used:
    • DDL can be divided into processing groups in accordance with your organizations specification for dependencies (all tables before indexes, for example). 
    • DML can be placed in a desired place in the processing order. 
    • Stored logic can be ordered according to demands of the SQL code base. 

Manifest File

See Packaging from a Manifest File

  • Large sets of changes are committed all of a piece (rather than in multiple commits of smaller scripts). 
  • Changes may be committed at any interval, but typically at longer intervals. 
  • Due to the size of the changes committed or due to special requirements, commit order must be specified manually. 

Copyright © Liquibase 2012-2022 - Proprietary and Confidential