migrations/Version20220828140520.php line 1

  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 Version20220828140520 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('CREATE TABLE grouped_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('CREATE TABLE grouped_synthesis_grouping (grouped_synthesis_id INT NOT NULL, grouping_id INT NOT NULL, PRIMARY KEY(grouped_synthesis_id, grouping_id))');
  20.         $this->addSql('CREATE INDEX IDX_9A787315CE51B623 ON grouped_synthesis_grouping (grouped_synthesis_id)');
  21.         $this->addSql('CREATE INDEX IDX_9A7873155DDE227E ON grouped_synthesis_grouping (grouping_id)');
  22.         $this->addSql('CREATE TABLE grouping (id INT NOT NULL, synthesis_id INT DEFAULT NULL, key VARCHAR(128) NOT NULL, index INT NOT NULL, PRIMARY KEY(id))');
  23.         $this->addSql('CREATE INDEX IDX_8FA8718EC91FE48 ON grouping (synthesis_id)');
  24.         $this->addSql('CREATE TABLE grouping_primitive (grouping_id INT NOT NULL, primitive_id INT NOT NULL, PRIMARY KEY(grouping_id, primitive_id))');
  25.         $this->addSql('CREATE INDEX IDX_7CA86B95DDE227E ON grouping_primitive (grouping_id)');
  26.         $this->addSql('CREATE INDEX IDX_7CA86B9621DFAA6 ON grouping_primitive (primitive_id)');
  27.         $this->addSql('ALTER TABLE grouped_synthesis ADD CONSTRAINT FK_A706582FBF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE grouped_synthesis_grouping ADD CONSTRAINT FK_9A787315CE51B623 FOREIGN KEY (grouped_synthesis_id) REFERENCES grouped_synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE grouped_synthesis_grouping ADD CONSTRAINT FK_9A7873155DDE227E FOREIGN KEY (grouping_id) REFERENCES grouping (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  30.         $this->addSql('ALTER TABLE grouping ADD CONSTRAINT FK_8FA8718EC91FE48 FOREIGN KEY (synthesis_id) REFERENCES synthesis (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  31.         $this->addSql('ALTER TABLE grouping ADD CONSTRAINT FK_8FA8718BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  32.         $this->addSql('ALTER TABLE grouping_primitive ADD CONSTRAINT FK_7CA86B95DDE227E FOREIGN KEY (grouping_id) REFERENCES grouping (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  33.         $this->addSql('ALTER TABLE grouping_primitive ADD CONSTRAINT FK_7CA86B9621DFAA6 FOREIGN KEY (primitive_id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  34.     }
  35.     public function down(Schema $schema): void
  36.     {
  37.         // this down() migration is auto-generated, please modify it to your needs
  38.         $this->addSql('ALTER TABLE grouped_synthesis_grouping DROP CONSTRAINT FK_9A787315CE51B623');
  39.         $this->addSql('ALTER TABLE grouped_synthesis_grouping DROP CONSTRAINT FK_9A7873155DDE227E');
  40.         $this->addSql('ALTER TABLE grouping_primitive DROP CONSTRAINT FK_7CA86B95DDE227E');
  41.         $this->addSql('DROP TABLE grouped_synthesis');
  42.         $this->addSql('DROP TABLE grouped_synthesis_grouping');
  43.         $this->addSql('DROP TABLE grouping');
  44.         $this->addSql('DROP TABLE grouping_primitive');
  45.     }
  46. }