<?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 Version20260121202045 extends AbstractMigration
{
// administrator-message-automations
public const REPORT_ID = 60;
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$this->addSql('ALTER TABLE message_automation_log ADD CONSTRAINT FK_B8C002C9D1C5DDC3 FOREIGN KEY (automation_id) REFERENCES message_automation (id) ON DELETE SET NULL');
$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));
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE message_automation_log');
$this->addSql(sprintf('DELETE FROM report WHERE id = %d', self::REPORT_ID));
}
}