To send your command output to a file, use the output-file parameter. The output-file parameter works with the diff command, snapshot command, and Liquibase SQL commands.

  • You can use the output-file parameter with diff and snapshot commands to gather the information about the current state of a database and send this information as a text-based version of the schema to a file.
  • You can use the output-file parameter with Liquibase SQL commands to receive an SQL script in a file instead of having it in the CLI.

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 output-file parameter

liquibase --output-file=../the/path/to/my/output/file update-sql

An example of running both output-file and log-file parameters

To get the log and output information from a command, use the output-file and log-file parameters simultaneously:

liquibase --output-file=mysnapshot.json --log-level=debug --log-file=liquibase.log snapshot

Related Links