migrations/Version20190106181951.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20190106181951 extends AbstractMigration
  10. {
  11.     public function up(Schema $schema): void
  12.     {
  13.         // this up() migration is auto-generated, please modify it to your needs
  14.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  15.         $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)\'');
  16.         $this->addSql('ALTER TABLE filter ADD report_id INT DEFAULT NULL');
  17.         $this->addSql('ALTER TABLE filter ADD CONSTRAINT FK_7FC45F1D4BD2A4C0 FOREIGN KEY (report_id) REFERENCES report (id) ON DELETE CASCADE');
  18.         $this->addSql('CREATE INDEX IDX_7FC45F1D4BD2A4C0 ON filter (report_id)');
  19.     }
  20.     public function down(Schema $schema): void
  21.     {
  22.         // this down() migration is auto-generated, please modify it to your needs
  23.         $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
  24.         $this->addSql('ALTER TABLE filter DROP FOREIGN KEY FK_7FC45F1D4BD2A4C0');
  25.         $this->addSql('DROP INDEX IDX_7FC45F1D4BD2A4C0 ON filter');
  26.         $this->addSql('ALTER TABLE filter DROP report_id');
  27.         $this->addSql('ALTER TABLE filter CHANGE section section ENUM(\'section_lead\',\'section_event\',\'section_feed\',\'section_issue\',\'section_message\') NOT NULL COMMENT \'(DC2Type:SectionType)\'');
  28.     }
  29. }