<?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 Version20220712152727 extends AbstractMigration
{
public function getDescription(): string
{
return 'Updated notification tables';
}
public function up(Schema $schema): void
{
$this->addSql("TRUNCATE notification_system;");
$this->addSql("alter table notification_system add message longtext not null;");
$this->addSql("alter table notification_system add related_item_id int null;");
$this->addSql("alter table notification_system add customer_id int not null;");
$this->addSql("alter table notification_system add notification_template_id int not null;");
$this->addSql("alter table notification_system drop foreign key FK_DEAEFD6460EF0B2;");
$this->addSql("drop index IDX_DEAEFD6460EF0B2 on notification_system;");
$this->addSql("create index notification_system_customer_index on notification_system (customer_id);");
$this->addSql("create index notification_system_template_index on notification_system (notification_template_id);");
$this->addSql("alter table notification_system drop column notification_customer_id;");
$this->addSql("alter table notification_system add constraint notification_system_customer_id_fk foreign key (customer_id) references customer (id);");
$this->addSql("alter table notification_system add constraint notification_system_notification_template_id_fk foreign key (notification_template_id) references notification_template (id);");
$this->addSql("TRUNCATE notification_customer;");
$this->addSql("alter table notification_customer change message_email message longtext not null;");
$this->addSql("alter table notification_customer change message_sms message_type integer not null;");
$this->addSql("alter table notification_customer drop column message_system;");
}
public function down(Schema $schema): void
{
}
}