outputFile Parameter

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

  • You can use the outputFile 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 outputFile parameter with Liquibase SQL commands to receive an SQL script in a file instead of having it in the CLI.

An example of running the outputFile parameter

liquibase --outputFile=../the/path/to/my/output/file updateSQL

An example of running both outputFile and logFile parameters

To get the log and output information from a command, use the outputFile and logFile parameters simultaneously:

liquibase --outputFile=mysnapshot.json --logLevel=debug --logFile=liquibase.log snapshot

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

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

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

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

Related Links