Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Re : Liquibase 2.0.5 does not seem to commit between changesets against MySQL 5.5

$
0
0
I have the same problem and it happens every time a changelog contains a ChangeSet that
creates a new table with foreign key constraints and one or more other ChangeSet(s) that use dropAllForeignKeyConstraints tag  to drop all foreing key constraints from that same table.

But the problem is not caused by MySQL or missing database commit, but due to the way the class
liquibase.change.core.DropAllForeignKeyConstraintsChange is implemented.

On the validation stage, liquibase.change.core.DropAllForeignKeyConstraintsChange.generateStatements(Database)
method is called, and here there are some lazy initialization statements for the private List attribute childDropChanges: on this stage both the new table has not been created yet and private attribute childDropChanges is not initialized yet, so the private method generateChildren(Database database) is called, but it doesn't find any foreign key constraint defined for the baseTableName declared (the table doesn't exist yet!), so the childDropChanges List attribute is initialized, empty...

When run stage arise, the List attribute childDropChanges of DropAllForeignKeyConstraintsChange has been
inizialized, so the lazy initialization code inside generateStatements(Database) is skipped, leaving the
List childDropChanges empty, even if, in the mean time, other ChangeSet created the table and its foreign key
constraints that one expects should be dropped!

So the change run successfully with an empty list of constraint to drop, leaving the table unchanged!

I'm stuck to the 2.0.5 version due to incompatibility of new versions of Liquibase with some extensions of mine: any solutions to suggest?

Many thanks in advance
Regards
Roberto

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>