-- 创建数据库
CREATE DATABASE IF NOT EXISTS data_center;
-- 使用数据库data_center
use data_center;
-- 创建设备状态表
CREATE STABLE IF NOT EXISTS device_status (`ts` TIMESTAMP,`online` TINYINT,`duration` INT) TAGS (`info` JSON);
-- 创建无效数据存储
CREATE STABLE IF NOT EXISTS device_invalid (`ts` TIMESTAMP,`keyword` NCHAR(20),`description` NCHAR(20)) TAGS (`device_id` NCHAR(20));
-- 创建告警表
CREATE STABLE IF NOT EXISTS alarm_log (`ts` TIMESTAMP, `alarm_value` DOUBLE, `level` INT, `status` INT, `whether_push` INT, `alarm_msg` NCHAR(64), `alarm_device_type` INT, `trigger_type` INT, `trigger_elements` NCHAR(128)) TAGS (`tenant_id` BIGINT, `application_id` BIGINT, `indicator_id` BIGINT, `monitor_point_id` BIGINT, `alarm_key` NCHAR(20), `alarm_type` INT, `alarm_rule_id` BIGINT, `device_id` BIGINT, `alarm_object` INT, `application_ids` NCHAR(128));