补充设备告警与休眠设置后端能力

This commit is contained in:
stu2not
2026-05-07 16:05:31 +08:00
parent cfa6a77134
commit f825c60176
10 changed files with 489 additions and 31 deletions

View File

@@ -367,6 +367,20 @@ CREATE TABLE IF NOT EXISTS `device_settings` (
REFERENCES `device_auth` (`device_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Device alarm events are reported by the device side through MQTT msg_id=010.
CREATE TABLE IF NOT EXISTS `device_alarm_events` (
`alarm_id` BIGINT NOT NULL AUTO_INCREMENT,
`device_id` VARCHAR(64) NOT NULL,
`owner_user_id` BIGINT NULL,
`child_id` BIGINT NULL,
`source_msg_id` VARCHAR(8) NOT NULL DEFAULT '010',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`alarm_id`),
KEY `idx_device_alarm_device_created` (`device_id`, `created_at`),
KEY `idx_device_alarm_owner_created` (`owner_user_id`, `created_at`),
KEY `idx_device_alarm_child_created` (`child_id`, `created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `im_conversations` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`conversation_type` TINYINT UNSIGNED NOT NULL,