migrations/Version20220712152727.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 Version20220712152727 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Updated notification tables';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql("TRUNCATE notification_system;");
  18.         $this->addSql("alter table notification_system add message longtext not null;");
  19.         $this->addSql("alter table notification_system add related_item_id int null;");
  20.         $this->addSql("alter table notification_system add customer_id int not null;");
  21.         $this->addSql("alter table notification_system add notification_template_id int not null;");
  22.         $this->addSql("alter table notification_system drop foreign key FK_DEAEFD6460EF0B2;");
  23.         $this->addSql("drop index IDX_DEAEFD6460EF0B2 on notification_system;");
  24.         $this->addSql("create index notification_system_customer_index on notification_system (customer_id);");
  25.         $this->addSql("create index notification_system_template_index on notification_system (notification_template_id);");
  26.         $this->addSql("alter table notification_system drop column notification_customer_id;");
  27.         $this->addSql("alter table notification_system add constraint notification_system_customer_id_fk foreign key (customer_id) references customer (id);");
  28.         $this->addSql("alter table notification_system add constraint notification_system_notification_template_id_fk foreign key (notification_template_id) references notification_template (id);");
  29.         $this->addSql("TRUNCATE notification_customer;");
  30.         $this->addSql("alter table notification_customer change message_email message longtext not null;");
  31.         $this->addSql("alter table notification_customer change message_sms message_type integer not null;");
  32.         $this->addSql("alter table notification_customer drop column message_system;");
  33.     }
  34.     public function down(Schema $schema): void
  35.     {
  36.     }
  37. }