I Run Liquibase with postgresql, where for each schema a new instanceof Liquibase is created and run with a different default-schema-name and changelog file.
liquibase then creates a lock and changelog table in each schema - which is very good for me because the schemas should be completley independent of eachother.
Today I run into a problem, which I think did not happen before because I always build the single modules(each module has one db schema), and in the context of the tests, the db-schemas are created and liquibase is run a single time.
But when running liquibase multiple times on the same vm with different default-schemas, the JdbcDatabaseSnapshotGenerator instance, which is referenced from a static instance (and thus being shared by all instances of liquibase on the same VM), caches the hasDatabaseChangeLogTable and the hasDatabaseChangeLogLockTable values. So, even if for the actual schema there is no lock table or changelog file, liquibase is informed it does exist, which ofcause does not work right.
So - I removed this fields from JdbcDatabaseSnapshotGenerator -
I searched just a bit and think that the only call to the methods that cache these values are when initializing liquibase, and I ask myself if it make sense to cache them. Usually, liquibase will be instanciated once, and ran once, not ? so there is no point in caching these values, because they are only used once, not? and if liquibase is run more than once, maybe it is better to check every time - as my settings show…
I am not sure, so I just wanted to ask (sorry for the long post) if I should commit the change ?