Clean up the tables that have no constraints first to shorten the time between drop/add constraints:
truncate table audit_detail_params;
truncate table audit_message;
truncate table audit_admin;
truncate table audit_system;
Drop the constraints that block truncating other tables:
alter table audit_system drop foreign key `audit_system_ibfk_1`;
alter table audit_admin drop foreign key `audit_admin_ibfk_1`;
alter table audit_message drop foreign key `audit_message_ibfk_1`;
alter table audit_detail drop foreign key `audit_detail_ibfk_1`;
alter table audit_detail_params drop foreign key `audit_detail_params_ibfk_1`;
truncate table audit_main;
truncate table audit_detail;
truncate table audit_detail_params;
truncate table audit_message;
truncate table audit_admin;
truncate table audit_system;
Re-add the constraints:
alter table audit_system add CONSTRAINT `audit_system_ibfk_1` FOREIGN KEY (`goid`) REFERENCES `audit_main` (`goid`) ON DELETE CASCADE ON UPDATE NO ACTION;
alter table audit_admin add CONSTRAINT `audit_admin_ibfk_1` FOREIGN KEY (`goid`) REFERENCES `audit_main` (`goid`) ON DELETE CASCADE ON UPDATE NO ACTION;
alter table audit_message add CONSTRAINT `audit_message_ibfk_1` FOREIGN KEY (`goid`) REFERENCES `audit_main` (`goid`) ON DELETE CASCADE ON UPDATE NO ACTION;
alter table audit_detail add CONSTRAINT `audit_detail_ibfk_1` FOREIGN KEY (`audit_goid`) REFERENCES `audit_main` (`goid`) ON DELETE CASCADE ON UPDATE NO ACTION;
alter table audit_detail_params add CONSTRAINT `audit_detail_params_ibfk_1` FOREIGN KEY (`audit_detail_goid`) REFERENCES `audit_detail` (`goid`) ON DELETE CASCADE ON UPDATE NO ACTION;
You can run all of these commands at once and more than once. If there is any errors on the re-add then run all the commands again.
Define Dictionary Meaning is an easy to use platform where anyone can create and share short informal definition of any word.
ReplyDeleteBest thing is, its free and you can even contribute without creating an account.
This page shows you usage and meanings of Goid around the world.
Thank you for influencing so many readers with your great information. Your article has sparked a lot of thought for me. I share your views.Define Dictionary Meaning is an easy to use platform where anyone can create and share short informal definition of any word.
ReplyDeleteBest thing is, its free and you can even contribute without creating an account.This page shows you usage and meanings of goid around the world.