updateSQL command

The updateSQL command is a helper command that allows you to inspect the SQL Liquibase will run while using the update command.

Uses

The updateSQL command is used when you want to inspect the raw SQL before running the update command, so you can correct any issues that may arise before running the command. Liquibase uses the raw SQL to apply database changes you have added to the changelog file.

Running the updateSQL command

To run the updateSQL command, you need to specify your driver, class path, URL, and user authentication information in your liquibase.properties file. For more information, see Creating and configuring a liquibase.properties file. You can also specify these properties in your command line.

Then run the updateSQL command:

liquibase --changeLogFile=sample.changelog.xml updateSQL

Note: Enter the name of the changelog you want to use in place of sample.changelog.xml.

updateSQL global attributes

Attribute Definition Requirement
--changeLogFile * Specifies the root changelog Required
--url Specifies the JDBC database connection URL Required
--username Specifies the database username Required
--password Specifies the database password Required
--outputFile ** Specifies the file path to where the update SQL will be written Optional

* Liquibase checks the changelog and any nested changelogs for the definitions of the changesets to update.

* * If not specified, update SQL output goes to STDOUT.

updateSQL command attributes

Attribute Definition Requirement
--labels Tags you can add to changesets to determine which changesets in the changelog to evaluate based on their labels Optional
--contexts Expressions you can add to changesets to determine which changesets in the changelog to evaluate based on their contexts Optional