Code Duplication    Length = 11-13 lines in 3 locations

src/Migrations/Version20200130170401.php 2 locations

@@ 20-30 (lines=11) @@
17
        return '';
18
    }
19
20
    public function up(Schema $schema) : void
21
    {
22
        // this up() migration is auto-generated, please modify it to your needs
23
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
24
25
        $this->addSql('ALTER TABLE media__media ADD cdn_flush_identifier VARCHAR(64) DEFAULT NULL');
26
        $this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F');
27
        $this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75');
28
        $this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id) ON DELETE CASCADE');
29
        $this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE CASCADE');
30
    }
31
32
    public function down(Schema $schema) : void
33
    {
@@ 32-42 (lines=11) @@
29
        $this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE CASCADE');
30
    }
31
32
    public function down(Schema $schema) : void
33
    {
34
        // this down() migration is auto-generated, please modify it to your needs
35
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
36
37
        $this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F');
38
        $this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75');
39
        $this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id)');
40
        $this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
41
        $this->addSql('ALTER TABLE media__media DROP cdn_flush_identifier');
42
    }
43
}
44

src/Migrations/Version20200214041355.php 1 location

@@ 40-52 (lines=13) @@
37
        return '';
38
    }
39
40
    public function up(Schema $schema) : void
41
    {
42
        // this up() migration is auto-generated, please modify it to your needs
43
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
44
45
        $this->addSql('CREATE TABLE RepertoireSeason (id INT AUTO_INCREMENT NOT NULL, startDate DATETIME NOT NULL, endDate DATETIME NOT NULL, number INT NOT NULL, UNIQUE INDEX UNIQ_C9FDBB996901F54 (number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
46
        $this->addSql('CREATE TABLE performance_repertoireseason (performance_id INT NOT NULL, repertoireseason_id INT NOT NULL, INDEX IDX_58AE5ABFB91ADEEE (performance_id), INDEX IDX_58AE5ABFAC76615 (repertoireseason_id), PRIMARY KEY(performance_id, repertoireseason_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
47
        $this->addSql('ALTER TABLE performance_repertoireseason ADD CONSTRAINT FK_58AE5ABFB91ADEEE FOREIGN KEY (performance_id) REFERENCES performances (id) ON DELETE CASCADE');
48
        $this->addSql('ALTER TABLE performance_repertoireseason ADD CONSTRAINT FK_58AE5ABFAC76615 FOREIGN KEY (repertoireseason_id) REFERENCES RepertoireSeason (id) ON DELETE CASCADE');
49
50
        $this->insertSeasons();
51
        $this->addSeasonsToPerformances();
52
    }
53
54
    protected function addSeasonsToPerformances()
55
    {