migrations/Version20220822140621.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 Version20220822140621 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 mosaic_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('CREATE TABLE mosaic_synthesis_component (mosaic_synthesis_id INT NOT NULL, component_id INT NOT NULL, PRIMARY KEY(mosaic_synthesis_id, component_id))');
  20.         $this->addSql('CREATE INDEX IDX_CF5508D44A5204A8 ON mosaic_synthesis_component (mosaic_synthesis_id)');
  21.         $this->addSql('CREATE INDEX IDX_CF5508D4E2ABAFFF ON mosaic_synthesis_component (component_id)');
  22.         $this->addSql('CREATE TABLE ordered_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
  23.         $this->addSql('CREATE TABLE ordered_synthesis_element (ordered_synthesis_id INT NOT NULL, element_id INT NOT NULL, PRIMARY KEY(ordered_synthesis_id, element_id))');
  24.         $this->addSql('CREATE INDEX IDX_65E6A653EACAFE1 ON ordered_synthesis_element (ordered_synthesis_id)');
  25.         $this->addSql('CREATE INDEX IDX_65E6A651F1F2A24 ON ordered_synthesis_element (element_id)');
  26.         $this->addSql('CREATE TABLE sorted_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
  27.         $this->addSql('CREATE TABLE sorted_synthesis_primitive (sorted_synthesis_id INT NOT NULL, primitive_id INT NOT NULL, PRIMARY KEY(sorted_synthesis_id, primitive_id))');
  28.         $this->addSql('CREATE INDEX IDX_F02C5459F68D02DB ON sorted_synthesis_primitive (sorted_synthesis_id)');
  29.         $this->addSql('CREATE INDEX IDX_F02C5459621DFAA6 ON sorted_synthesis_primitive (primitive_id)');
  30.         $this->addSql('ALTER TABLE mosaic_synthesis ADD CONSTRAINT FK_48AFCCDBF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  31.         $this->addSql('ALTER TABLE mosaic_synthesis_component ADD CONSTRAINT FK_CF5508D44A5204A8 FOREIGN KEY (mosaic_synthesis_id) REFERENCES mosaic_synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  32.         $this->addSql('ALTER TABLE mosaic_synthesis_component ADD CONSTRAINT FK_CF5508D4E2ABAFFF FOREIGN KEY (component_id) REFERENCES component (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  33.         $this->addSql('ALTER TABLE ordered_synthesis ADD CONSTRAINT FK_990C3868BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  34.         $this->addSql('ALTER TABLE ordered_synthesis_element ADD CONSTRAINT FK_65E6A653EACAFE1 FOREIGN KEY (ordered_synthesis_id) REFERENCES ordered_synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  35.         $this->addSql('ALTER TABLE ordered_synthesis_element ADD CONSTRAINT FK_65E6A651F1F2A24 FOREIGN KEY (element_id) REFERENCES element (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  36.         $this->addSql('ALTER TABLE sorted_synthesis ADD CONSTRAINT FK_DA399845BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  37.         $this->addSql('ALTER TABLE sorted_synthesis_primitive ADD CONSTRAINT FK_F02C5459F68D02DB FOREIGN KEY (sorted_synthesis_id) REFERENCES sorted_synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  38.         $this->addSql('ALTER TABLE sorted_synthesis_primitive ADD CONSTRAINT FK_F02C5459621DFAA6 FOREIGN KEY (primitive_id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  39.         $this->addSql('DROP TABLE synthesis_component');
  40.     }
  41.     public function down(Schema $schema): void
  42.     {
  43.         // this down() migration is auto-generated, please modify it to your needs
  44.         $this->addSql('ALTER TABLE mosaic_synthesis_component DROP CONSTRAINT FK_CF5508D44A5204A8');
  45.         $this->addSql('ALTER TABLE ordered_synthesis_element DROP CONSTRAINT FK_65E6A653EACAFE1');
  46.         $this->addSql('ALTER TABLE sorted_synthesis_primitive DROP CONSTRAINT FK_F02C5459F68D02DB');
  47.         $this->addSql('CREATE TABLE synthesis_component (synthesis_id INT NOT NULL, component_id INT NOT NULL, PRIMARY KEY(synthesis_id, component_id))');
  48.         $this->addSql('CREATE INDEX idx_be49406ee2abafff ON synthesis_component (component_id)');
  49.         $this->addSql('CREATE INDEX idx_be49406eec91fe48 ON synthesis_component (synthesis_id)');
  50.         $this->addSql('ALTER TABLE synthesis_component ADD CONSTRAINT fk_be49406eec91fe48 FOREIGN KEY (synthesis_id) REFERENCES synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  51.         $this->addSql('ALTER TABLE synthesis_component ADD CONSTRAINT fk_be49406ee2abafff FOREIGN KEY (component_id) REFERENCES component (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  52.         $this->addSql('DROP TABLE mosaic_synthesis');
  53.         $this->addSql('DROP TABLE mosaic_synthesis_component');
  54.         $this->addSql('DROP TABLE ordered_synthesis');
  55.         $this->addSql('DROP TABLE ordered_synthesis_element');
  56.         $this->addSql('DROP TABLE sorted_synthesis');
  57.         $this->addSql('DROP TABLE sorted_synthesis_primitive');
  58.     }
  59. }