One of those doh!! moments when you do something quickly to get it working and didn’t think through the consequences.
I had 3 linked tables in a database that had constraints on them. I had forgotten I had put these constraints in there (3 years have passed since I did this work).
I truncated one of the tables to re-import from the dev system with some added fields. Unfortunately the constraint wiped the 3rd table.
I couldn’t re-import from the backup to the accidentally deleted table due to constraint errors.
A quick and hacky fix was required;
SET GLOBAL FOREIGN_KEY_CHECKS=0;
Do the import, then.
SET GLOBAL FOREIGN_KEY_CHECKS=1;
This was on an old project, On new projects I use migrations so this would have been avoided.
My recommendation is that if you aren’t already using the migrations feature in your php framework to start using them immediately to avoid headaches in the future when going from your development environment to your staging environment.