migrations/Version20260401000002.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. final class Version20260401000002 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Create notification_event_logs table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE notification_event_logs (
  15.             id INT AUTO_INCREMENT NOT NULL,
  16.             notification_event_rule_id INT NOT NULL,
  17.             entity_type VARCHAR(100) NOT NULL,
  18.             entity_id INT NOT NULL,
  19.             scheduled_for DATETIME NOT NULL,
  20.             sent_at DATETIME DEFAULT NULL,
  21.             failed_at DATETIME DEFAULT NULL,
  22.             error_message LONGTEXT DEFAULT NULL,
  23.             created_at DATETIME NOT NULL,
  24.             updated_at DATETIME NOT NULL,
  25.             PRIMARY KEY(id),
  26.             INDEX idx_nel_scheduled_for (scheduled_for),
  27.             INDEX idx_nel_sent_at (sent_at),
  28.             INDEX idx_nel_entity (entity_type, entity_id),
  29.             INDEX idx_nel_rule_id (notification_event_rule_id),
  30.             CONSTRAINT fk_nel_notification_event_rule
  31.                 FOREIGN KEY (notification_event_rule_id)
  32.                 REFERENCES notification_event_rules (id)
  33.                 ON DELETE CASCADE
  34.         ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         $this->addSql('DROP TABLE notification_event_logs');
  39.     }
  40. }