Use the includeAll tag to specify a directory that contains multiple changelog files. It is used within your root changelog file to call on the directory and include all XML, YAML, and JSON files as changelog files, and all SQL files as individual changes.


In Liquibase, you can break up your root changelog into more manageable pieces by creating multiple changelogs to separate your changesets in a way that makes sense for you. For example, you can separate changesets into their own files, according to features, releases, or other logical boundaries. Breaking up your changelogs can make it easier to find and manage complex database schema scripts.

If you house all of your changelog files into one directory, you can use the <includeAll> tag to reference the directory where all those files live.

How to use the includeAll tag

  1. Create a root changelog file.
  2. The root changelog file works as a configuration file that holds all the references to other directories. Your root changelog file must be in an XML, YAML, or JSON format.

    Note: At this time, the <includeAll> tag cannot be used in an SQL formatted root changelog.

  3. Add the <includeAll> tag and file references to your root changelog.
  4. Note: Your changelogs inside of the directory can be in SQL, XML, YAML, or JSON file types.

How the includeAll tag runs in a changelog

All files inside of the included directory are run in alphabetical order.

If you use the includeAll tag, enforce a naming strategy to prevent conflicts and the need to rename and reorder files.

About infinite loops in changelogs

Liquibase does not check for looping changelogs in your root file. However, if you create a changelog loop like the following, you will get an infinite loop which will prevent the operation from completing:

Example: root.changelog.xml includes the path com/example/changelogs/ which includes a changelog changelogloop.xml which includes root.changelog.xml.

Make sure to avoid infinite loops when referencing directories.

If you create an infinite loop, Liquibase will display the following error, and will continue to loop until the process runs out of memory:

Unexpected error running Liquibase: Unknown reason

Available attributes

Attribute Description Requirement
path Name of the path you want to reference. Required
errorIfMissingOrEmpty Controls what happens if the path listed does not exist or is an empty directory. Default: false. If set to true, the update will fail.  
relativeToChangelogFile File path relative to the changelog file containing the element rather than looked up in the search path. Default: false. Optional
resourceComparator A string containing the name of the class you want to use for sorting.  
filter Allows you to specify a custom filter class to include or exclude files from the <includeAll> search. Your class must implement the IncludeAllFilter interface.  

Appends a context (using an AND statement) to all contained changesets.

Note: Contexts only work with the <includeAll> tag when referencing non-SQL files.

Example: <includeAll path="files" contextFilter="deploy_version1"/>


Related links