Skip to content

Commit

Permalink
Remove dangling judgetasks first
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vmcj committed May 30, 2024
1 parent 21a217e commit 4f4e475
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions webapp/migrations/Version20230508120033.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public function getDescription(): string

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

0 comments on commit 4f4e475

Please sign in to comment.