<?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 Version20190106181951 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE filter CHANGE section section ENUM(\'section_lead\',\'section_event\',\'section_feed\',\'section_issue\',\'section_message\',\'section_report\') NOT NULL COMMENT \'(DC2Type:SectionType)\'');
$this->addSql('ALTER TABLE filter ADD report_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE filter ADD CONSTRAINT FK_7FC45F1D4BD2A4C0 FOREIGN KEY (report_id) REFERENCES report (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_7FC45F1D4BD2A4C0 ON filter (report_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE filter DROP FOREIGN KEY FK_7FC45F1D4BD2A4C0');
$this->addSql('DROP INDEX IDX_7FC45F1D4BD2A4C0 ON filter');
$this->addSql('ALTER TABLE filter DROP report_id');
$this->addSql('ALTER TABLE filter CHANGE section section ENUM(\'section_lead\',\'section_event\',\'section_feed\',\'section_issue\',\'section_message\') NOT NULL COMMENT \'(DC2Type:SectionType)\'');
}
}