From df78c81a692678f193e7297fe959a881e3a22efe Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 24 Nov 2023 14:03:18 +0100 Subject: [PATCH] Add migrations for stuff that is out of sync between models and the DB. --- webapp/migrations/Version20231124123934.php | 38 +++++++++++++++++++ webapp/migrations/Version20231124124901.php | 42 +++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 webapp/migrations/Version20231124123934.php create mode 100644 webapp/migrations/Version20231124124901.php diff --git a/webapp/migrations/Version20231124123934.php b/webapp/migrations/Version20231124123934.php new file mode 100644 index 0000000000..2cd67c93d9 --- /dev/null +++ b/webapp/migrations/Version20231124123934.php @@ -0,0 +1,38 @@ +addSql('ALTER TABLE queuetask CHANGE judgingid judgingid INT UNSIGNED DEFAULT NULL COMMENT \'Judging ID\''); + $this->addSql('ALTER TABLE submission CHANGE import_error import_error VARCHAR(255) DEFAULT NULL COMMENT \'The error message for submissions which got an error during shadow importing.\''); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE queuetask CHANGE judgingid judgingid INT UNSIGNED DEFAULT NULL COMMENT \'All queuetasks with the same jobid belong together.\''); + $this->addSql('ALTER TABLE submission CHANGE import_error import_error VARCHAR(255) DEFAULT NULL COMMENT \'If this submission was imported during shadowing but had an error while doing so, the error message.\''); + } + + public function isTransactional(): bool + { + return false; + } +} diff --git a/webapp/migrations/Version20231124124901.php b/webapp/migrations/Version20231124124901.php new file mode 100644 index 0000000000..d7d5f30d04 --- /dev/null +++ b/webapp/migrations/Version20231124124901.php @@ -0,0 +1,42 @@ +addSql('ALTER TABLE queuetask DROP FOREIGN KEY FK_45E85FF85D5FEA72'); + $this->addSql('DROP INDEX jobid ON queuetask'); + $this->addSql('CREATE INDEX judgingid ON queuetask (judgingid)'); + $this->addSql('ALTER TABLE queuetask ADD CONSTRAINT FK_45E85FF85D5FEA72 FOREIGN KEY (judgingid) REFERENCES judging (judgingid) ON DELETE CASCADE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE queuetask DROP FOREIGN KEY FK_45E85FF85D5FEA72'); + $this->addSql('DROP INDEX judgingid ON queuetask'); + $this->addSql('CREATE INDEX jobid ON queuetask (judgingid)'); + $this->addSql('ALTER TABLE queuetask ADD CONSTRAINT FK_45E85FF85D5FEA72 FOREIGN KEY (judgingid) REFERENCES judging (judgingid) ON DELETE CASCADE'); + } + + public function isTransactional(): bool + { + return false; + } +}