25 lines
877 B
Plaintext
25 lines
877 B
Plaintext
CREATE TABLE IF NOT EXISTS anomaly_events (
|
|
event_id INT AUTO_INCREMENT PRIMARY KEY,
|
|
timestamp BIGINT NOT NULL,
|
|
work_order_id VARCHAR(255) NOT NULL,
|
|
anomaly_type VARCHAR(100) NOT NULL,
|
|
severity ENUM('critical', 'warning', 'info') NOT NULL,
|
|
title VARCHAR(255) NOT NULL,
|
|
description TEXT,
|
|
data_json TEXT,
|
|
kpi_snapshot_json TEXT,
|
|
status ENUM('active', 'acknowledged', 'resolved') DEFAULT 'active',
|
|
cycle_count INT DEFAULT 0,
|
|
occurrence_count INT DEFAULT 1,
|
|
last_occurrence BIGINT,
|
|
acknowledged_at BIGINT,
|
|
resolved_at BIGINT,
|
|
auto_resolved BOOLEAN DEFAULT FALSE,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
INDEX idx_work_order (work_order_id),
|
|
INDEX idx_status (status),
|
|
INDEX idx_timestamp (timestamp),
|
|
INDEX idx_anomaly_type (anomaly_type)
|
|
);
|
|
|