Liquibase uses the DATABASECHANGELOGLOCK table to ensure only one instance of Liquibase is running at one time.

Because Liquibase simply reads from the DATABASECHANGELOG table to determine which changesets need to run, if multiple instances of Liquibase are executed against the same database concurrently you will get conflicts. This can happen if multiple developers use the same database instance or if there are multiple servers in a cluster which auto-run Liquibase on startup.

Column Standard data type Description
ID INT ID of the lock. Currently there is only one lock, but is available for future use.
LOCKED INT Set to "1" if the Liquibase is running against this database. Otherwise set to "0"
LOCKGRANTED DATETIME Date and time that the lock was granted.
LOCKEDBY VARCHAR(255) Human-readable description of who the lock was granted to.

Note: If Liquibase does not exit cleanly, the lock row may be left as locked. You can clear out the current lock by running liquibase releaseLocks which runs UPDATE DATABASECHANGELOGLOCK SET LOCKED=0

Related Links