<?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 Version20201102163036 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 user ADD notify_on_assigned_stream TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE notification CHANGE type type ENUM(\'system\',\'customer\',\'customer_comment\',\'customer_message\',\'customer_file\',\'customer_upsell_request\',\'customer_rating_log\',\'lead\',\'event\',\'feed\',\'project\',\'stream\',\'issue\') NOT NULL COMMENT \'(DC2Type:NotificationSectionType)\'');
$this->addSql('ALTER TABLE notification ADD stream_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_BF5476CAD0ED463E FOREIGN KEY (stream_id) REFERENCES stream (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_BF5476CAD0ED463E ON notification (stream_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_BF5476CAD0ED463E');
$this->addSql('DROP INDEX IDX_BF5476CAD0ED463E ON notification');
$this->addSql('ALTER TABLE notification DROP stream_id');
$this->addSql('ALTER TABLE notification CHANGE type type ENUM(\'system\',\'customer\',\'customer_comment\',\'customer_message\',\'customer_file\',\'customer_upsell_request\',\'customer_rating_log\',\'lead\',\'event\',\'feed\',\'project\',\'issue\') NOT NULL COMMENT \'(DC2Type:NotificationSectionType)\'');
$this->addSql('ALTER TABLE user DROP notify_on_assigned_stream');
}
}