migrations/Version20211101220342.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20211101220342 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE chant ADD recueil_id INT NOT NULL');
  19.         $this->addSql('ALTER TABLE chant ADD CONSTRAINT FK_3217777C31D7EA0 FOREIGN KEY (recueil_id) REFERENCES recueil (id)');
  20.         $this->addSql('CREATE INDEX IDX_3217777C31D7EA0 ON chant (recueil_id)');
  21.         $this->addSql('ALTER TABLE fichier ADD chant_id INT DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE fichier ADD CONSTRAINT FK_9B76551F1BE84489 FOREIGN KEY (chant_id) REFERENCES chant (id)');
  23.         $this->addSql('CREATE INDEX IDX_9B76551F1BE84489 ON fichier (chant_id)');
  24.         $this->addSql('ALTER TABLE programme ADD template_id INT NOT NULL');
  25.         $this->addSql('ALTER TABLE programme ADD CONSTRAINT FK_3DDCB9FF5DA0FB8 FOREIGN KEY (template_id) REFERENCES template (id)');
  26.         $this->addSql('CREATE INDEX IDX_3DDCB9FF5DA0FB8 ON programme (template_id)');
  27.         $this->addSql('ALTER TABLE programme_champ ADD template_champ_id INT NOT NULL, ADD chant_id INT DEFAULT NULL');
  28.         $this->addSql('ALTER TABLE programme_champ ADD CONSTRAINT FK_1C7BBD7A8C7C997D FOREIGN KEY (template_champ_id) REFERENCES template_champ (id)');
  29.         $this->addSql('ALTER TABLE programme_champ ADD CONSTRAINT FK_1C7BBD7A1BE84489 FOREIGN KEY (chant_id) REFERENCES chant (id)');
  30.         $this->addSql('CREATE INDEX IDX_1C7BBD7A8C7C997D ON programme_champ (template_champ_id)');
  31.         $this->addSql('CREATE INDEX IDX_1C7BBD7A1BE84489 ON programme_champ (chant_id)');
  32.         $this->addSql('ALTER TABLE template_champ ADD template_id INT NOT NULL');
  33.         $this->addSql('ALTER TABLE template_champ ADD CONSTRAINT FK_1CB733625DA0FB8 FOREIGN KEY (template_id) REFERENCES template (id)');
  34.         $this->addSql('CREATE INDEX IDX_1CB733625DA0FB8 ON template_champ (template_id)');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         // this down() migration is auto-generated, please modify it to your needs
  39.         $this->addSql('ALTER TABLE chant DROP FOREIGN KEY FK_3217777C31D7EA0');
  40.         $this->addSql('DROP INDEX IDX_3217777C31D7EA0 ON chant');
  41.         $this->addSql('ALTER TABLE chant DROP recueil_id');
  42.         $this->addSql('ALTER TABLE fichier DROP FOREIGN KEY FK_9B76551F1BE84489');
  43.         $this->addSql('DROP INDEX IDX_9B76551F1BE84489 ON fichier');
  44.         $this->addSql('ALTER TABLE fichier DROP chant_id');
  45.         $this->addSql('ALTER TABLE programme DROP FOREIGN KEY FK_3DDCB9FF5DA0FB8');
  46.         $this->addSql('DROP INDEX IDX_3DDCB9FF5DA0FB8 ON programme');
  47.         $this->addSql('ALTER TABLE programme DROP template_id');
  48.         $this->addSql('ALTER TABLE programme_champ DROP FOREIGN KEY FK_1C7BBD7A8C7C997D');
  49.         $this->addSql('ALTER TABLE programme_champ DROP FOREIGN KEY FK_1C7BBD7A1BE84489');
  50.         $this->addSql('DROP INDEX IDX_1C7BBD7A8C7C997D ON programme_champ');
  51.         $this->addSql('DROP INDEX IDX_1C7BBD7A1BE84489 ON programme_champ');
  52.         $this->addSql('ALTER TABLE programme_champ DROP template_champ_id, DROP chant_id');
  53.         $this->addSql('ALTER TABLE template_champ DROP FOREIGN KEY FK_1CB733625DA0FB8');
  54.         $this->addSql('DROP INDEX IDX_1CB733625DA0FB8 ON template_champ');
  55.         $this->addSql('ALTER TABLE template_champ DROP template_id');
  56.     }
  57. }