<?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 Version20211227112408 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 TABLE deal_site');
$this->addSql('ALTER TABLE deal ADD site_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC116F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)');
$this->addSql('CREATE INDEX IDX_E3FEC116F6BD1646 ON deal (site_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE deal_site (deal_id INT NOT NULL, site_id INT NOT NULL, INDEX IDX_DF3E6C4BF6BD1646 (site_id), INDEX IDX_DF3E6C4BF60E2305 (deal_id), PRIMARY KEY(deal_id, site_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE deal_site ADD CONSTRAINT FK_DF3E6C4BF6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal_site ADD CONSTRAINT FK_DF3E6C4BF60E2305 FOREIGN KEY (deal_id) REFERENCES deal (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC116F6BD1646');
$this->addSql('DROP INDEX IDX_E3FEC116F6BD1646 ON deal');
$this->addSql('ALTER TABLE deal DROP site_id');
}
}