<?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 Version20190912203201 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->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE notification ADD rating_log_id INT DEFAULT NULL, CHANGE type type ENUM(\'system\', \'customer\', \'customer_comment\', \'customer_message\', \'customer_file\', \'customer_upsell_request\', \'customer_rating_log\', \'lead\', \'event\', \'issue\', \'feed\') NOT NULL COMMENT \'(DC2Type:NotificationSectionType)\'');
$this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_BF5476CAC595370E FOREIGN KEY (rating_log_id) REFERENCES customer_rating_log (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_BF5476CAC595370E ON notification (rating_log_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 notification DROP FOREIGN KEY FK_BF5476CAC595370E');
$this->addSql('DROP INDEX IDX_BF5476CAC595370E ON notification');
$this->addSql('ALTER TABLE notification DROP rating_log_id, CHANGE type type ENUM(\'system\', \'customer\', \'customer_comment\', \'customer_message\', \'customer_file\', \'customer_upsell_request\', \'lead\', \'event\', \'issue\', \'feed\') DEFAULT NULL COLLATE utf8mb4_unicode_ci COMMENT \'(DC2Type:NotificationSectionType)\'');
}
}