Skip to content

Commit 4f4e475

Browse files
committed
Remove dangling judgetasks first
One way to get those is to remove a contest with judgetasks. When the contest is removed the submissions are also removed but not the judgetasks.
1 parent 21a217e commit 4f4e475

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

webapp/migrations/Version20230508120033.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public function getDescription(): string
1919

2020
public function up(Schema $schema): void
2121
{
22+
// Cleanup judgetasks for removed submissions
23+
// This can happen when a full contest has been removed and the full delete cascade has failed.
24+
$this->addSql('DELETE from judgetask WHERE submitid not in (SELECT submitid FROM submission)');
2225
// this up() migration is auto-generated, please modify it to your needs
2326
$this->addSql('ALTER TABLE judgetask ADD CONSTRAINT FK_83142B703605A691 FOREIGN KEY (submitid) REFERENCES submission (submitid) ON DELETE CASCADE');
2427
}

0 commit comments

Comments
 (0)