In our application there are four database (MS SQL SERVER) namely
- db1
2.db2
3.db3
4.db4
While connecting to SQL using liquibase we use db2 in connection string and then perform deployment.
As db2 is used in connection string DATABASECHANGELOGLOCK and DATABASECHANGELOG are created in db2 database.
As a part of deployment, every sql script has database name at the start like
-
Script1.sql
Use db1
GO
—update/delete statements
GO -
Script2.sql
Use db2
GO
—update/delete statements
GO -
Script3.sql
Use db3
GO
—update/delete statements
GO -
Script4.sql
Use db4
GO
—update/delete statements
GO
If the last script in the deployment is db2 (as it is specifed in the connection string and the DATABASECHANGELOGLOCK and DATABASECHANGELOG) are created in db2 database.
then the deployment succeeds
But if the last script is of some other database (other than db2) it gves error
liquibase.exception.LockException: liquibase.exception.LockException: Did not update change log lock correctly.
Seems it goes to search the DATABASECHANGELOGLOCK and DATABASECHANGELOG in the database in which last script is deployed.
How I can handle this ?