DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
701 stars 249 forks source link

Check all foreign key constraints without `ON DELETE` clause #2465

Open eldering opened 2 months ago

eldering commented 2 months ago

Description of the problem

In #2464 it was found that we have a foreign key constraint that should have an ON DELETE CASCADE clause. In general, almost every FK constraint should have either ON DELETE CASCADE or ON DELETE SET NULL. We should check and if necessary fix all of these:

CREATE TABLE `debug_package`
  CONSTRAINT `FK_9E17399BE0E4FC3E` FOREIGN KEY (`judgehostid`) REFERENCES `judgehost` (`judgehostid`)

-- This one is ok I think:
CREATE TABLE `executable`
  CONSTRAINT `FK_D68EDA01979A9F09` FOREIGN KEY (`immutable_execid`) REFERENCES `immutable_executable` (`immutable_execid`)

CREATE TABLE `judgetask`
  CONSTRAINT `judgetask_ibfk_1` FOREIGN KEY (`judgehostid`) REFERENCES `judgehost` (`judgehostid`)

CREATE TABLE `judging_run`
  CONSTRAINT `judging_run_ibfk_1` FOREIGN KEY (`testcaseid`) REFERENCES `testcase` (`testcaseid`),

CREATE TABLE `version`
  CONSTRAINT `FK_BF1CD3C32271845` FOREIGN KEY (`langid`) REFERENCES `language` (`langid`),
  CONSTRAINT `FK_BF1CD3C3E0E4FC3E` FOREIGN KEY (`judgehostid`) REFERENCES `judgehost` (`judgehostid`)