soc.sql 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. -- soc v0.1.1 版本升级脚本
  2. DELIMITER ??
  3. DROP PROCEDURE IF EXISTS schema_change ??
  4. CREATE PROCEDURE schema_change()
  5. BEGIN
  6. END ??
  7. DELIMITER ;
  8. CALL schema_change();
  9. -- 新增ups设备表
  10. drop table if exists iot_ups;
  11. create table if not exists iot_ups
  12. (
  13. id bigint not null
  14. primary key,
  15. org_id bigint null comment '机构id',
  16. org_name varchar(255) null comment '机构名称',
  17. org_path varchar(255) null comment '机构path',
  18. host_code varchar(64) null comment '视频物联网检测主机唯一标识',
  19. device_name varchar(100) null comment '设备名称',
  20. device_type varchar(32) null comment '设备类型',
  21. device_code varchar(64) null comment '设备code',
  22. ups_unique_code varchar(225) null comment 'ups唯一标识,机构code+主机code+deviceCode组成设备唯一',
  23. info varchar(2000) null comment '属性信息数组',
  24. deleted int default 0 null comment '0正常1删除',
  25. state_update_time datetime null comment '最后一次状态更新时间',
  26. update_time datetime null comment '更新时间,最后一次数据上传时间',
  27. create_time datetime null comment '创建时间',
  28. create_by varchar(255) null comment '创建人',
  29. update_by varchar(32) null comment '修改人',
  30. source int default 1 null comment '设备来源:0:平台主动新增,1:iot推送',
  31. status int default 2 null comment '设备告警状态: 0:正常,1:异常,2:未知',
  32. mains_electricity_status int default 2 null comment 'ups市电状态,0:正常1:异常2:未知',
  33. low_pressure_status int default 2 null comment 'ups电池电压低告警,0:正常1:异常2:未知',
  34. constraint idx_unique_ups_code unique (ups_unique_code)
  35. )
  36. comment 'ups表信息' row_format = DYNAMIC;
  37. -- 新增ups设备日志表
  38. drop table if exists iot_ups_data_log;
  39. create table if not exists iot_ups_data_log
  40. (
  41. id bigint not null
  42. primary key,
  43. org_id bigint null comment '机构id',
  44. org_name varchar(255) null comment '机构名称',
  45. org_path varchar(255) null comment '机构path',
  46. host_code varchar(64) null comment '视频物联网检测主机唯一标识',
  47. device_name varchar(100) null comment '设备名称',
  48. device_type varchar(32) null comment '设备类型',
  49. device_code varchar(64) null comment '设备code',
  50. ups_unique_code varchar(225) null comment 'ups唯一标识,机构code+主机code+deviceCode组成设备唯一',
  51. info varchar(2000) null comment '属性信息数组',
  52. deleted int default 0 null comment '0正常1删除',
  53. state_update_time datetime null comment '最后一次状态更新时间',
  54. update_time datetime null comment '更新时间,最后一次数据上传时间',
  55. create_time datetime null comment '创建时间',
  56. create_by varchar(255) null comment '创建人',
  57. update_by varchar(32) null comment '修改人',
  58. source int default 1 null comment '设备来源:0:平台主动新增,1:iot推送',
  59. status int default 2 null comment '设备告警状态: 0:正常,1:异常,2:未知',
  60. mains_electricity_status int default 2 null comment 'ups市电状态,0:正常1:异常2:未知',
  61. low_pressure_status int default 2 null comment 'ups电池电压低告警,0:正常1:异常2:未知',
  62. ups_id bigint null comment 'ups表id',
  63. constraint idx_unique_ups_code unique (ups_unique_code)
  64. )
  65. comment 'ups表信息' row_format = DYNAMIC;
  66. -- 新增ups设备属性表
  67. drop table if exists iot_ups_attr;
  68. create table if not exists iot_ups_attr
  69. (
  70. id int auto_increment
  71. primary key,
  72. rule_key varchar(50) null,
  73. rule_value int null,
  74. unit varchar(50) null,
  75. start int default 0 null
  76. )
  77. comment 'ups设备属性' row_format = DYNAMIC;