migrations/Version20260121202045.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 Version20260121202045 extends AbstractMigration
  10. {
  11.     // administrator-message-automations
  12.     public const REPORT_ID 60;
  13.     public function getDescription(): string
  14.     {
  15.         return '';
  16.     }
  17.     public function up(Schema $schema): void
  18.     {
  19.         // this up() migration is auto-generated, please modify it to your needs
  20.         $this->addSql('CREATE TABLE message_automation_log (id INT AUTO_INCREMENT NOT NULL, automation_id INT DEFAULT NULL, entity_class VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, entity_name VARCHAR(255) DEFAULT NULL, channel ENUM(\'email\', \'sms\') DEFAULT NULL COMMENT \'(DC2Type:MessageAutomationChannelType)\', recipient VARCHAR(255) DEFAULT NULL, subject VARCHAR(255) DEFAULT NULL, body LONGTEXT DEFAULT NULL, offset_days INT DEFAULT NULL, status ENUM(\'pending\', \'sent\', \'failed\', \'skipped\') NOT NULL COMMENT \'(DC2Type:MessageAutomationStatusType)\', error LONGTEXT DEFAULT NULL, sent_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, modified_at DATETIME NOT NULL, INDEX idx_status (status), INDEX idx_sent_at (sent_at), INDEX idx_entity (entity_class, entity_id), INDEX idx_automation (automation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE message_automation_log ADD CONSTRAINT FK_B8C002C9D1C5DDC3 FOREIGN KEY (automation_id) REFERENCES message_automation (id) ON DELETE SET NULL');
  22.         $this->addSql(sprintf('INSERT INTO report (id, token, name, category, enabled, sort_order) VALUES (%d, \'administrator-message-automations\', \'Message Automations\', \'Management\', 1, 7)'self::REPORT_ID));
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('DROP TABLE message_automation_log');
  28.         $this->addSql(sprintf('DELETE FROM report WHERE id = %d'self::REPORT_ID));
  29.     }
  30. }