File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public function up(Schema $schema): void
23
23
{
24
24
$ this ->dropKeys ();
25
25
$ this ->addKeys (true );
26
+
27
+ $ this ->addSql ('ALTER TABLE submission ADD CONSTRAINT FK_DB055AF3F132696E FOREIGN KEY (userid) REFERENCES user (userid) ON DELETE SET NULL ' );
26
28
}
27
29
28
30
public function down (Schema $ schema ): void
@@ -31,6 +33,9 @@ public function down(Schema $schema): void
31
33
32
34
// Reinstate the 'restrict' keys.
33
35
$ this ->addKeys (false );
36
+
37
+ $ this ->addSql ('ALTER TABLE submission ADD CONSTRAINT FK_DB055AF3F132696E FOREIGN KEY (userid) REFERENCES user (userid) ON DELETE CASCADE ' );
38
+
34
39
}
35
40
36
41
public function dropKeys (): void
@@ -41,6 +46,7 @@ public function dropKeys(): void
41
46
$ this ->addSql ('ALTER TABLE judging_run DROP CONSTRAINT FK_29A6E6E13CBA64F2 ' );
42
47
$ this ->addSql ('ALTER TABLE judging_run DROP CONSTRAINT judging_run_ibfk_1 ' );
43
48
$ this ->addSql ('ALTER TABLE judgetask DROP CONSTRAINT judgetask_ibfk_1 ' );
49
+ $ this ->addSql ('ALTER TABLE submission DROP FOREIGN KEY FK_DB055AF3F132696E ' );
44
50
}
45
51
46
52
public function addKeys (bool $ suffix ): void
@@ -55,6 +61,7 @@ public function addKeys(bool $suffix): void
55
61
$ this ->addSql ('ALTER TABLE judging_run ADD CONSTRAINT `judging_run_ibfk_1` FOREIGN KEY (`testcaseid`) REFERENCES `testcase` (`testcaseid`) ' . $ cascadeClause );
56
62
$ this ->addSql ('ALTER TABLE judgetask ADD CONSTRAINT `judgetask_ibfk_1` FOREIGN KEY (`judgehostid`) REFERENCES `judgehost` (`judgehostid`) ' . $ null );
57
63
$ this ->addSql ('ALTER TABLE debug_package ADD CONSTRAINT `FK_9E17399BE0E4FC3E` FOREIGN KEY (`judgehostid`) REFERENCES `judgehost` (`judgehostid`) ' . $ null );
64
+
58
65
}
59
66
60
67
public function isTransactional (): bool
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ class Submission extends BaseApiEntity implements
118
118
private Team $ team ;
119
119
120
120
#[ORM \ManyToOne(inversedBy: 'submissions ' )]
121
- #[ORM \JoinColumn(name: 'userid ' , referencedColumnName: 'userid ' , onDelete: 'CASCADE ' )]
121
+ #[ORM \JoinColumn(name: 'userid ' , referencedColumnName: 'userid ' , onDelete: 'SET NULL ' )]
122
122
#[Serializer \Exclude]
123
123
private ?User $ user = null ;
124
124
You can’t perform that action at this time.
0 commit comments