修复测试预警异常迁移校验
恢复已应用的 V41 迁移内容,新增 V42 修正开放异常唯一键,避免启动时 Flyway 校验和不一致并支持异常关闭后再次生成。
| | |
| | | handled_at_utc DATETIME(3) NULL, |
| | | handling_note VARCHAR(1000) NULL, |
| | | PRIMARY KEY (exception_id), |
| | | open_threshold_id BIGINT GENERATED ALWAYS AS (IF(exception_status = 'OPEN', threshold_id, NULL)) STORED, |
| | | UNIQUE KEY uk_warning_exception_open (test_id, metric_code, open_threshold_id), |
| | | UNIQUE KEY uk_warning_exception_open (test_id, metric_code, threshold_id, exception_status), |
| | | KEY idx_warning_exception_query (test_id, exception_status, last_occurred_at_utc) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='测试预警阈值异常'; |
| New file |
| | |
| | | ALTER TABLE t_test_warning_exception |
| | | DROP INDEX uk_warning_exception_open, |
| | | ADD COLUMN open_threshold_id BIGINT GENERATED ALWAYS AS ( |
| | | IF(exception_status = 'OPEN', threshold_id, NULL) |
| | | ) STORED AFTER exception_status, |
| | | ADD UNIQUE KEY uk_warning_exception_open (test_id, metric_code, open_threshold_id); |