From 2fa5b5102b97fcecafc523dc06f5350c3b5b2385 Mon Sep 17 00:00:00 2001 From: Jeppe Krogh Date: Wed, 18 Dec 2024 11:54:18 +0100 Subject: [PATCH] Fixed migrations --- migrations/Version20241217091428.php | 33 ---------------------- migrations/Version20241218105400.php | 41 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 33 deletions(-) delete mode 100644 migrations/Version20241217091428.php create mode 100644 migrations/Version20241218105400.php diff --git a/migrations/Version20241217091428.php b/migrations/Version20241217091428.php deleted file mode 100644 index 10825d34f..000000000 --- a/migrations/Version20241217091428.php +++ /dev/null @@ -1,33 +0,0 @@ -addSql('ALTER TABLE version ADD is_billable TINYINT(1) NOT NULL'); - $this->addSql('ALTER TABLE worker ADD include_in_reports TINYINT(1) DEFAULT 1 NOT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE worker DROP include_in_reports'); - $this->addSql('ALTER TABLE version DROP is_billable'); - } -} diff --git a/migrations/Version20241218105400.php b/migrations/Version20241218105400.php new file mode 100644 index 000000000..19e49d8c8 --- /dev/null +++ b/migrations/Version20241218105400.php @@ -0,0 +1,41 @@ +addSql('CREATE TABLE epic (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE issue_epic (issue_id INT NOT NULL, epic_id INT NOT NULL, INDEX IDX_412E98BD5E7AA58C (issue_id), INDEX IDX_412E98BD6B71E00E (epic_id), PRIMARY KEY(issue_id, epic_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE issue_epic ADD CONSTRAINT FK_412E98BD5E7AA58C FOREIGN KEY (issue_id) REFERENCES issue (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE issue_epic ADD CONSTRAINT FK_412E98BD6B71E00E FOREIGN KEY (epic_id) REFERENCES epic (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE version ADD is_billable TINYINT(1) NOT NULL'); + $this->addSql('ALTER TABLE worker ADD include_in_reports TINYINT(1) DEFAULT 1 NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE issue_epic DROP FOREIGN KEY FK_412E98BD5E7AA58C'); + $this->addSql('ALTER TABLE issue_epic DROP FOREIGN KEY FK_412E98BD6B71E00E'); + $this->addSql('DROP TABLE epic'); + $this->addSql('DROP TABLE issue_epic'); + $this->addSql('ALTER TABLE worker DROP include_in_reports'); + $this->addSql('ALTER TABLE version DROP is_billable'); + } +}