Files
cattleTransportation/tradeCattle/add_tenant_id_field.sql
2025-10-23 17:28:06 +08:00

11 lines
437 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.

-- 在iot_device_data表中添加tenant_id字段关联到sys_tenant表的主键
-- 用于实现租户设备分配功能
ALTER TABLE `iot_device_data`
ADD COLUMN `tenant_id` int(11) DEFAULT NULL COMMENT '租户ID关联sys_tenant表主键';
-- 添加外键约束(可选)
-- ALTER TABLE `iot_device_data`
-- ADD CONSTRAINT `fk_iot_device_tenant`
-- FOREIGN KEY (`tenant_id`) REFERENCES `sys_tenant`(`id`) ON DELETE SET NULL;