update-count
The update-count
command sequentially updates a specified number of changesets on your database.
Uses
The update-count
command is mainly used when you want to apply changes and update changesets sequentially, starting with the changesets from the top of the changelog file until the number specified is reached.
The image below shows four changesets: changeset a, changeset b, changeset c, and changeset d. As you can see, changeset a is already deployed on the database. So, running the command update-count 2
, deploys changeset b and c without applying changeset d.
Additionally, the best practice is to run the update-count-sql
helper command because it allows you to inspect the update-count
SQL, so you can correct any issues that may arise before running the command.
Running the update-count
command
To run the update-count
command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Specifying Properties in a Connection Profile. You can also specify them from the command line.
Then run the update-count
command:
liquibase --changelog-file=myChangelog.xml update-count 2
Note: Enter the name of the changelog and number you want to use in place of myChangelog.xml
and 2
.
update-count
global attributes
Attribute | 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 |
* Liquibase will check nested changelogs for definitions of the changesets to update.
Note: The username
and password
attributes are not required for connections and systems which use alternate means of authentication.
update-count
command attributes
Attribute | Definition | Requirement |
---|---|---|
<value>
|
The integer indicating the number of changes you want to update | Required |

Liquibase Version: 4.9.1
Liquibase Community 4.9.1 by Liquibase
----------------------------------------------------------------------
View a report of this operation at https://hub.liquibase.com/r/ZxJO4WxSG4
* IMPORTANT: New users of Hub first need to Sign In to your account
with the one-time password sent to your email, which also serves as
your username.
----------------------------------------------------------------------
Liquibase command 'update-count' was executed successfully.