<?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 Version20211021110121 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 position_extra_set (position_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', extra_set_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_AACDBE28DD842E46 (position_id), INDEX IDX_AACDBE28C6D735B0 (extra_set_id), PRIMARY KEY(position_id, extra_set_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE answer_extra_set (answer_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', extra_set_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_C2136083AA334807 (answer_id), INDEX IDX_C2136083C6D735B0 (extra_set_id), PRIMARY KEY(answer_id, extra_set_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE position_extra_set ADD CONSTRAINT FK_AACDBE28DD842E46 FOREIGN KEY (position_id) REFERENCES assortment_product_position (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE position_extra_set ADD CONSTRAINT FK_AACDBE28C6D735B0 FOREIGN KEY (extra_set_id) REFERENCES assortment_extra_set (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE answer_extra_set ADD CONSTRAINT FK_C2136083AA334807 FOREIGN KEY (answer_id) REFERENCES assortment_question_set_question_answer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE answer_extra_set ADD CONSTRAINT FK_C2136083C6D735B0 FOREIGN KEY (extra_set_id) REFERENCES assortment_extra_set (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE assortment_product_position DROP extra_set_id, CHANGE question_set_id question_set_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE assortment_product_position ADD CONSTRAINT FK_67E9B5FE17A62210 FOREIGN KEY (question_set_id) REFERENCES assortment_question_set (id)');
$this->addSql('CREATE INDEX IDX_67E9B5FE17A62210 ON assortment_product_position (question_set_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE position_extra_set');
$this->addSql('DROP TABLE answer_extra_set');
$this->addSql('ALTER TABLE assortment_product_position DROP FOREIGN KEY FK_67E9B5FE17A62210');
$this->addSql('DROP INDEX IDX_67E9B5FE17A62210 ON assortment_product_position');
$this->addSql('ALTER TABLE assortment_product_position ADD extra_set_id INT DEFAULT NULL, CHANGE question_set_id question_set_id INT DEFAULT NULL');
}
public function isTransactional(): bool
{
return false;
}
}