纳入范围: - backend/ Spring Boot 多模块后端(iot-common/device/rule/data/alarm/auth) - frontend/admin/ Vue3 + Element Plus 管理后台 - Android/ 涂鸦原生 APP (com.xhai.iot) - backend/sql/ Flyway 风格迁移脚本(V2~V21) - docs/ 对接文档与设计文档 排除范围: - 构建产物: node_modules/ target/ build/ dist/ .gradle/ - 签名密钥: *.jks *.keystore (严禁入库) - 本机配置: Android/local.properties - 运行日志: logs/ *.log - AI 协作本地数据 .codebuddy/ 与第三方 demo tuya-demo/ .gitattributes 统一以 LF 存储, Windows 批处理保留 CRLF
24 lines
1.2 KiB
SQL
24 lines
1.2 KiB
SQL
-- ============================================================
|
||
-- 产品管理收尾(V14)
|
||
-- 1) 移除 Device 冗余字段 model/manufacturer(统一从 product 取)
|
||
-- 2) 用 platform_product_id 承接涂鸦 productId(原本滥用 model 列)
|
||
-- 3) AiDeviceProfile 下沉产品级(product_id,同类设备共享指令码)
|
||
-- ============================================================
|
||
|
||
-- 1) device 承接平台原始产品ID(原本把涂鸦 productId 塞进 model 列)
|
||
ALTER TABLE device ADD COLUMN platform_product_id VARCHAR(128) DEFAULT NULL
|
||
COMMENT '平台原始产品ID(如涂鸦productId)' AFTER `home_id`;
|
||
|
||
-- 2) 存量涂鸦设备:把 model(=涂鸦productId) 迁到 platform_product_id
|
||
UPDATE device
|
||
SET platform_product_id = model
|
||
WHERE platform = 'tuya' AND model IS NOT NULL AND platform_product_id IS NULL;
|
||
|
||
-- 3) 移除 Device 冗余字段(型号/厂商统一从 product 取)
|
||
ALTER TABLE device DROP COLUMN model;
|
||
ALTER TABLE device DROP COLUMN manufacturer;
|
||
|
||
-- 4) AiDeviceProfile 加 product_id,支撑产品级指令码(同类设备共享)
|
||
ALTER TABLE ai_device_profile ADD COLUMN product_id BIGINT DEFAULT NULL
|
||
COMMENT '产品ID(产品级指令码, 同类设备共享)' AFTER `owner_id`;
|