ddl.sql 1.1 KB

1234567891011121314151617
  1. SET FOREIGN_KEY_CHECKS=0;
  2. ALTER TABLE `zkt_alarm_record` DROP INDEX `INDEX_ALARM_ITEM_OBJ_TAR`;
  3. ALTER TABLE `zkt_alarm_record` ADD COLUMN `ITEM_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '报警类型ID' AFTER `END_TIME`;
  4. ALTER TABLE `zkt_alarm_record` MODIFY COLUMN `DEFINITION_ID` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '报警定义ID(报警对象ID-报警类型ID)' FIRST;
  5. ALTER TABLE `zkt_alarm_record` MODIFY COLUMN `PROJECT_ID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目ID' AFTER `DEFINITION_ID`;
  6. ALTER TABLE `zkt_alarm_record` MODIFY COLUMN `ITEM_CODE` varchar(42) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报警条目编码' AFTER `OBJ_ID`;
  7. ALTER TABLE `zkt_alarm_record` DROP COLUMN `TARGET_ID`;
  8. ALTER TABLE `zkt_alarm_record` ADD UNIQUE INDEX `INDEX_ALARM_ITEM_OBJ_TAR`(`ITEM_CODE`, `OBJ_ID`) USING BTREE COMMENT '一个报警条目,一个对象在一个报警报警匹配规则只能对应一条报警定义';
  9. SET FOREIGN_KEY_CHECKS=1;