yeg
2026-09-03 84c4a0c7c750bf8ac87d40fbf4071ff6ac0fc7e2
修复测试预警异常迁移校验

恢复已应用的 V41 迁移内容,新增 V42 修正开放异常唯一键,避免启动时 Flyway 校验和不一致并支持异常关闭后再次生成。
1个文件已添加
1个文件已修改
9 ■■■■■ 已修改文件
ruoyi-admin/src/main/resources/db/migration/V41__test_warning_exceptions.sql 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/db/migration/V42__test_warning_exception_open_uniqueness.sql 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/db/migration/V41__test_warning_exceptions.sql
@@ -17,7 +17,6 @@
    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='测试预警阈值异常';
ruoyi-admin/src/main/resources/db/migration/V42__test_warning_exception_open_uniqueness.sql
New file
@@ -0,0 +1,6 @@
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);