<?php
declare(strict_types=1);
return [
    'up' => "CREATE TABLE `alert_log` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `alert_rule_id` BIGINT UNSIGNED NOT NULL,
    `triggered_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `context_json` JSON NULL COMMENT 'entity details that triggered it',
    `recipients_json` JSON NULL COMMENT 'who was notified',
    `status` VARCHAR(20) NOT NULL DEFAULT 'sent' COMMENT 'sent, failed, acknowledged',
    `acknowledged_by` BIGINT UNSIGNED NULL,
    `acknowledged_at` TIMESTAMP NULL,
    CONSTRAINT `fk_alert_log_rule` FOREIGN KEY (`alert_rule_id`) REFERENCES `alert_rules` (`id`) ON DELETE CASCADE,
    INDEX `idx_alert_log_rule` (`alert_rule_id`),
    INDEX `idx_alert_log_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `alert_log`",
];
