migrations/Version20220822140621.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220822140621 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE mosaic_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
$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))');
$this->addSql('CREATE INDEX IDX_CF5508D44A5204A8 ON mosaic_synthesis_component (mosaic_synthesis_id)');
$this->addSql('CREATE INDEX IDX_CF5508D4E2ABAFFF ON mosaic_synthesis_component (component_id)');
$this->addSql('CREATE TABLE ordered_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
$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))');
$this->addSql('CREATE INDEX IDX_65E6A653EACAFE1 ON ordered_synthesis_element (ordered_synthesis_id)');
$this->addSql('CREATE INDEX IDX_65E6A651F1F2A24 ON ordered_synthesis_element (element_id)');
$this->addSql('CREATE TABLE sorted_synthesis (id INT NOT NULL, PRIMARY KEY(id))');
$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))');
$this->addSql('CREATE INDEX IDX_F02C5459F68D02DB ON sorted_synthesis_primitive (sorted_synthesis_id)');
$this->addSql('CREATE INDEX IDX_F02C5459621DFAA6 ON sorted_synthesis_primitive (primitive_id)');
$this->addSql('ALTER TABLE mosaic_synthesis ADD CONSTRAINT FK_48AFCCDBF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$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');
$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');
$this->addSql('ALTER TABLE ordered_synthesis ADD CONSTRAINT FK_990C3868BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$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');
$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');
$this->addSql('ALTER TABLE sorted_synthesis ADD CONSTRAINT FK_DA399845BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$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');
$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');
$this->addSql('DROP TABLE synthesis_component');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mosaic_synthesis_component DROP CONSTRAINT FK_CF5508D44A5204A8');
$this->addSql('ALTER TABLE ordered_synthesis_element DROP CONSTRAINT FK_65E6A653EACAFE1');
$this->addSql('ALTER TABLE sorted_synthesis_primitive DROP CONSTRAINT FK_F02C5459F68D02DB');
$this->addSql('CREATE TABLE synthesis_component (synthesis_id INT NOT NULL, component_id INT NOT NULL, PRIMARY KEY(synthesis_id, component_id))');
$this->addSql('CREATE INDEX idx_be49406ee2abafff ON synthesis_component (component_id)');
$this->addSql('CREATE INDEX idx_be49406eec91fe48 ON synthesis_component (synthesis_id)');
$this->addSql('ALTER TABLE synthesis_component ADD CONSTRAINT fk_be49406eec91fe48 FOREIGN KEY (synthesis_id) REFERENCES synthesis (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE synthesis_component ADD CONSTRAINT fk_be49406ee2abafff FOREIGN KEY (component_id) REFERENCES component (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE mosaic_synthesis');
$this->addSql('DROP TABLE mosaic_synthesis_component');
$this->addSql('DROP TABLE ordered_synthesis');
$this->addSql('DROP TABLE ordered_synthesis_element');
$this->addSql('DROP TABLE sorted_synthesis');
$this->addSql('DROP TABLE sorted_synthesis_primitive');
}
}