update-one-changeset

Note: This is a Liquibase Pro command, so you need a Liquibase Pro License Key to use it.

The update-one-changeset command lets you target and deploy any specific changeset in your changelog to your database. It is only available for Liquibase Pro users.

Uses

The update-one-changeset command is useful if your changelog contains several undeployed changesets and you want to deploy only one specific changeset, but not the others.

The update command deploys all changesets, and the update-count command deploys a specified number of changesets in sequential order. However, update-one-changeset lets you deploy any single changeset anywhere in the changelog without affecting other undeployed changesets.

Impacts of update-one-changeset

Like any targeted tool, using the update-one-changeset command comes with risks of unintended consequences. Because of this, the command requires a --force flag to indicate that you intend to run it.

Warning: Look for potential unintended consequences before using this command.

It is a best practice to run the update-one-changeset-sql command because it allows you to inspect the update SQL and search for any potential mistakes before you execute update-one-changeset.

Running the update-one-changeset command

Before running the update-one-changeset command, gather the following information from your changelog:

  • The author of the changeset you want to deploy
  • The ID of the changeset you want to deploy
  • The file name (changeset path) of the changeset you want to deploy

Then run the update-one-changeset command, with your information:

liquibase update-one-changeset --changeset-id=2 --changeset-author=anotherdev --changeset-path=example-changelog.sql --force

For more command specific help, type liquibase update-one-changeset --help into the command prompt.

update-one-changeset global attributes

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.

Parameter Definition Requirement
--changelog-file

The root changelog

Required
--url

The JDBC database connection URL

Required
--username

The database username

Required
--password

The database password

Required
--liquibaseProLicenseKey

Your Liquibase Pro license key

Required

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.

update-one-changeset command attributes

Parameter Definition Requirement
--changeset-id

The changeset ID from the changelog.

Required
--changeset-author

The name of the author for the changeset.

Required
--changeset-path

The path to the changelog containing the changeset you want to roll back.

Required
--force

A required parameter which indicates you intend to use this feature.

Required

Output

When successful, the update-one-changeset command produces the following output:

$ liquibase update-one-changeset --changeset-id=2 --changeset-author=anotherdev --changeset-path=example-changelog.sql --force

Running Changeset: example-changelog.sql::2::anotherdev
Liquibase command 'update-one-changeset' was executed successfully.

If you omit the --force attribute, Liquibase displays the following error:

$ liquibase update-one-changeset --changeset-id=2 --changeset-author=anotherdev --changeset-path=example-changelog.sql

Unexpected error running Liquibase: WARNING: Targeted update of this changeset may result in unexpected outcomes.  To review the update SQL before executing it, please run 'update-one-changeset-sql'. This message can be suppressed by adding the --force flag.

Like what you see? Try this command in Pro for Free.