changeLogFile Parameter

Liquibase changelog file is a root file that contains a record of all your database changes (changesets). The changeLogFile parameter helps you create a changelog file using the generateChangeLog command or diffChangeLog command, apply changes to your database, and keep track of your database information.

  • Use the generateChangeLog command and the changeLogFile parameter if you want to capture the current state of a database. The command creates the changelog file with a sequence of changesets, which describes how to re-create your database. Then, you can apply those changesets to any number of databases.

Note: To generate a changelog file using Ant and Maven, run the Ant generateChangeLog Task with the outputfile parameter and the Maven generateChangeLog goal with the outputChangeLogFile parameter.

  • Use the diffChangeLog command with the changeLogFile parameter to have the information on differences between the two databases you are comparing. The command creates the changelog file containing deployable changesets to synchronize multiple databases.

Tip: To create an empty changelog file, go to your Liquibase directory and create a new text file with the .xml, .sql, .yaml, or .json extension.

To apply changes related to a specific changelog file, run the changeLogFile parameter and the needed command. You can also set the parameter in the file.

An example of running the changeLogFile parameter

liquibase --changeLogFile=dbchangelog.xml update

changelog-file CLI Usage in Liquibase 4.4+

Starting from Liquibase 4.4, there are changes in how you can configure Liquibase or how you can type commands and parameters, in particular changeLogFile. The Liquibase CLI functionality aims to be backward compatible with all previous versions. However, it is a best practice to follow the syntax rules mentioned in the Command Line Interface instruction and in the --help output.

An example of running the changelog-file parameter

liquibase update --changelog-file=dbchangelog.xml

Related Links