<?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 Version20211201111901 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 category_mail (category_id INT NOT NULL, mail_id INT NOT NULL, INDEX IDX_DABDD60F12469DE2 (category_id), INDEX IDX_DABDD60FC8776F01 (mail_id), PRIMARY KEY(category_id, mail_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE category_mail ADD CONSTRAINT FK_DABDD60F12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE category_mail ADD CONSTRAINT FK_DABDD60FC8776F01 FOREIGN KEY (mail_id) REFERENCES mail (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C190BEFADC');
$this->addSql('DROP INDEX IDX_64C19C190BEFADC ON category');
$this->addSql('ALTER TABLE category DROP mails_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE category_mail');
$this->addSql('ALTER TABLE category ADD mails_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C190BEFADC FOREIGN KEY (mails_id) REFERENCES mail (id)');
$this->addSql('CREATE INDEX IDX_64C19C190BEFADC ON category (mails_id)');
}
}