We sometimes see the following error when upgrading one of our databases. It seems to happen when we have a database that has had previous upgrades using liquibase 1.9.4 (and therefore ‘databasechangelog/lock’ tables created already) and then attempt an upgrade using liquibase 2.0.1.
We have also had situations where we get two sets of change log tables - one set in upper case and one in lower case. This appears to happen if you create a MySQL database on Windows where it creates lower case table names and then take a database dump and restore it on a Linux box.
I am not certain if this is strictly an issue between Windows and Linux with MySQL, or if liquibase has some code that is sometimes case sensitive and others not. It could also be a JDBC driver issue.
I do not know the upgrade logic in liquibase, but in the case where we take a MySQL database dump from Windows to Linux, it seems that liquibase upgrade ignores the lowercase table names and creates brand new upper case change log tables. However, then the the problem happens due to the logic in The lowercase table is the old version, and then an error occurs.
Our QA group has since said they can reproduce the error completely on Windows only. This would seem to indicate that maybe it is different versions of liquibase that were the cause of the lowercase and uppercase change log table names.
In fact, in the Windows only scenario, the QA group reports that they do not see the two sets of tables - just the one set in lowercase. The thought then is that liquibase 2.0 sees the lowercase tables (as it does not create a duplicate set in uppercase) but for some reason does not upgrade the lowercase versions - perhaps the upgrade code is case sensitive somehow, e.g. table names in quotes?
Hope this additional information might ring a bell or provide some additional clue as to what’s going on. Thanks.
I think I found the problem. The first method I’m calling after creating my Liquibase object is listUnrunChangeSets() and this method is missing a call to checkDatabaseChangeLogTable, e.g. the line in red is the missing code.
public List listUnrunChangeSets(String contexts) throws LiquibaseException {