update-one-changeset

Note: This is a Liquibase Pro feature, 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.

Impact

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.

Syntax

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 path and name of the changeset you want to deploy

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

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

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

Global arguments

Tip: For best results, specify all commands and parameters in the --kebab-case format in the CLI. If your preference is camelCase, it also works in the CLI.

Parameter Definition Requirement
--license-key

Your Liquibase Pro license key

Required

Command arguments

Parameter Definition Requirement
--changeset-author

The name of the author for the changeset. Supports * as a wildcard.

Required
--changeset-id

The changeset ID from the changelog.

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. If you specify --force or --force=true, the command executes. If you omit the parameter or specify --force=false, the command does not execute. Default: false.

Required
--url

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required
--default-catalog-name

Name of the default catalog to use for the database connection

Optional
--default-schema-name

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional
--driver

The JDBC driver class

Optional
--driver-properties-file

The JDBC driver properties file

Optional
--force-on-partial-changes

Liquibase Pro only. Use this argument only if you are specifying --rollback-on-error=true to automatically roll back update operations containing errors. --force-on-partial-changes=true specifies whether Liquibase rolls back partially invalid changesets, such as a changeset containing two changes: one with an error and one without an error. This ensures that you can successfully roll back all changes if a deployment has an error, even if the changeset contains multiple changes. Available in Liquibase 4.25.0+. Default: false. See also: failOnError.

Optional
--password

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
--rollback-on-error

Liquibase Pro only. If any changeset in a deployment fails, --rollback-on-error stops the update operation and rolls back all changesets you just deployed. Available in Liquibase 4.18.0+. Default: false.

Note: A changeset marked failOnError=false does not trigger as an error, so rollback-on-error will not occur. Additionally, if a changeset is not auto-rollback compliant or does not have a rollback script, then rollback-on-error does not occur for any changeset. Read more: failOnError.

Optional
--username

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication. Also, you can specify database credentials as part of the url attribute.

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.