<?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 Version20250131065154 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('DROP INDEX IDX_EA750E8F639F774 ON label');
$this->addSql('ALTER TABLE label DROP campaign_id');
$this->addSql('CREATE TABLE campaign_label (campaign_id BIGINT UNSIGNED NOT NULL, label_id BIGINT UNSIGNED NOT NULL, INDEX IDX_4A810EA7F639F774 (campaign_id), INDEX IDX_4A810EA733B92F39 (label_id), PRIMARY KEY(campaign_id, label_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE campaign_label ADD CONSTRAINT FK_4A810EA7F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE campaign_label ADD CONSTRAINT FK_4A810EA733B92F39 FOREIGN KEY (label_id) REFERENCES label (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE campaign_label DROP FOREIGN KEY FK_4A810EA7F639F774');
$this->addSql('ALTER TABLE campaign_label DROP FOREIGN KEY FK_4A810EA733B92F39');
$this->addSql('DROP TABLE campaign_label');
$this->addSql('ALTER TABLE label ADD campaign_id BIGINT UNSIGNED DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_EA750E8F639F774 ON label (campaign_id)');
}
}