<?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 Version20220523081003 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 promotion_shop_mode (promotion_id INT NOT NULL, shop_mode_id INT NOT NULL, INDEX IDX_274F70FD139DF194 (promotion_id), INDEX IDX_274F70FD74D6C560 (shop_mode_id), PRIMARY KEY(promotion_id, shop_mode_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE promotion_shop_mode ADD CONSTRAINT FK_274F70FD139DF194 FOREIGN KEY (promotion_id) REFERENCES promotion (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE promotion_shop_mode ADD CONSTRAINT FK_274F70FD74D6C560 FOREIGN KEY (shop_mode_id) REFERENCES shop_mode (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE promotion DROP FOREIGN KEY FK_C11D7DD174D6C560');
$this->addSql('DROP INDEX IDX_C11D7DD174D6C560 ON promotion');
$this->addSql('ALTER TABLE promotion DROP shop_mode_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE promotion_shop_mode');
$this->addSql('ALTER TABLE promotion ADD shop_mode_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE promotion ADD CONSTRAINT FK_C11D7DD174D6C560 FOREIGN KEY (shop_mode_id) REFERENCES shop_mode (id)');
$this->addSql('CREATE INDEX IDX_C11D7DD174D6C560 ON promotion (shop_mode_id)');
}
}