migrations/Version20260401000001.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 Version20260401000001 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Create notification_event_rules table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE notification_event_rules (
  15.             id INT AUTO_INCREMENT NOT NULL,
  16.             notification_system_id INT NOT NULL,
  17.             trigger_timing VARCHAR(50) NOT NULL,
  18.             trigger_values JSON DEFAULT NULL,
  19.             status_condition JSON DEFAULT NULL,
  20.             is_enabled TINYINT(1) NOT NULL DEFAULT 1,
  21.             created_at DATETIME NOT NULL,
  22.             updated_at DATETIME NOT NULL,
  23.             deleted_at DATETIME DEFAULT NULL,
  24.             PRIMARY KEY(id),
  25.             INDEX idx_ner_trigger_timing (trigger_timing),
  26.             INDEX idx_ner_is_enabled (is_enabled),
  27.             INDEX idx_ner_notification_system_id (notification_system_id),
  28.             CONSTRAINT fk_ner_notification_system
  29.                 FOREIGN KEY (notification_system_id)
  30.                 REFERENCES notification_system (id)
  31.                 ON DELETE CASCADE
  32.         ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  33.     }
  34.     public function down(Schema $schema): void
  35.     {
  36.         $this->addSql('DROP TABLE notification_event_rules');
  37.     }
  38. }