changelog-file

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

  • Use the generate-changelog command and the changelog-file 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 generate-changelog Task with the output-file parameter and the Maven generateChangeLog goal with the outputChangeLogFile parameter.

  • Use the diff-changelog command with the changelog-file 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 changelog-file parameter and the needed command. You can also set the parameter in the Liquibase properties file.

Tip: All commands and parameters use the --kebab-case format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.

An example of running the changelog-file parameter

liquibase --changelog-file=dbchangelog.xml update

Related Links