Files
junhong_cmp_fiber/migrations/archive/000090_device_fields_extension.up.sql

15 lines
939 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 扩展 tb_device 设备表,新增 Gateway sync-info 同步的存储字段
-- 这些字段有"离线意义"设备下线后仍需保留最后状态非实时字段rssi/battery 等)不入库
ALTER TABLE tb_device
ADD COLUMN online_status INT NOT NULL DEFAULT 0,
ADD COLUMN last_online_time TIMESTAMP NULL,
ADD COLUMN software_version VARCHAR(100) NOT NULL DEFAULT '',
ADD COLUMN switch_mode VARCHAR(10) NOT NULL DEFAULT '0',
ADD COLUMN last_gateway_sync_at TIMESTAMP NULL;
COMMENT ON COLUMN tb_device.online_status IS '在线状态0未知1在线2离线';
COMMENT ON COLUMN tb_device.last_online_time IS '最后在线时间(来自 Gateway sync-info';
COMMENT ON COLUMN tb_device.software_version IS '固件版本号';
COMMENT ON COLUMN tb_device.switch_mode IS '切卡模式0=自动1=手动';
COMMENT ON COLUMN tb_device.last_gateway_sync_at IS '最后一次 sync-info 同步时间';