1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE TABLE t_test_warning_exception (
    exception_id BIGINT NOT NULL AUTO_INCREMENT,
    test_id BIGINT NOT NULL,
    threshold_id BIGINT NOT NULL,
    source_type VARCHAR(32) NOT NULL,
    source_identity VARCHAR(255) NOT NULL DEFAULT '',
    metric_code VARCHAR(100) NOT NULL,
    abnormal_value DECIMAL(30,12) NOT NULL,
    unit VARCHAR(32) NOT NULL,
    rule_snapshot JSON NOT NULL,
    severity VARCHAR(32) NOT NULL DEFAULT 'WARNING',
    exception_status VARCHAR(16) NOT NULL DEFAULT 'OPEN',
    first_occurred_at_utc DATETIME(3) NOT NULL,
    last_occurred_at_utc DATETIME(3) NOT NULL,
    occurrence_count BIGINT NOT NULL DEFAULT 1,
    handled_by BIGINT NULL,
    handled_at_utc DATETIME(3) NULL,
    handling_note VARCHAR(1000) NULL,
    PRIMARY KEY (exception_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='测试预警阈值异常';