Foreign Keys not committing? [MYSQL]

Hey, I’ve been struggling with this issue for a while now. I still have no idea what is actually going on, but feel like I’ve narrowed it down enough that hopefully someone can help me.

We have been using liquibase for about 2 years at work, about 1 year ago we renamed some of the tables (which then renames the “referenced table names” on some foreign keys.)

In production when this change was run originally everything worked fine and we have not had any issues with it. But now when creating the database from scratch locally, it seems like these foreign key changes are made in some way where they don’t get fully committed.

The foreign key shows up as having its name correctly updated if I query the database. But if I make an ALTER to the table (E.g just adding an unrelated column, even outside of liquibase), the foreign key table name change gets reverted. So basically because we alter the table after the table name has changed, the foreign keys break.

If I turn on and off the Mysql server a bunch of the foreign keys disappear as well and the referenced table name is reverted.

If I export the database (to a .sql file) and then import it again, the foreign keys keep their updated name, and they do not revert back if I update the table. So I have gotten it to work by commenting out the changelogs that update the table, and then export and importing the table, and then running the final changelogs, but obviously don’t want to have to do that.

Any help very much appreciated.

If anyone has any suggestions on how to further troubleshoot this that would also be much appreciated because I feel completely lost here and not sure how to figure it out any further :frowning:

Hi Earl,
can you specify liquibase version, operating system, mysql driver, and mysql exact version? I’ll test it.