Sunday, 4 August 2019

sql script to add foreign keys

First change each table to InnoDB using Table Operations menu

ALTER TABLE `file` ADD FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `method` ADD FOREIGN KEY (`file_id`) REFERENCES `file`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `calls` ADD FOREIGN KEY (`host_method_id`) REFERENCES `method`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `api_call` ADD FOREIGN KEY (`host_method_id`) REFERENCES `method`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;

No comments:

Post a Comment

what is a good PhD contribution?

When PhD candidates embark on their thesis journey, the first thing they will likely learn is that their research must be a “significant ori...