SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for cdr_event_sgwc
-- ----------------------------
CREATE TABLE IF NOT EXISTS `cdr_event_sgwc` (
  `id` int NOT NULL AUTO_INCREMENT,
  `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `timestamp` bigint DEFAULT '0' COMMENT '接收到的timestamp秒级存储毫秒时间戳',
  `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'data JSON String',
  `created_at` bigint DEFAULT '0' COMMENT '记录创建存储毫秒',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_sgwc_uid_t` (`rm_uid`,`timestamp`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='CDR事件_SGWC';

-- ----------------------------
-- COLUMN for cdr_event_sgwc
-- ----------------------------
ALTER TABLE `cdr_event_sgwc` DROP INDEX `id`;
ALTER TABLE `cdr_event_sgwc` DROP INDEX `idx_type_timestamp`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' AFTER `id`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' AFTER `ne_type`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `rm_uid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' AFTER `ne_name`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `timestamp` bigint(20) NULL DEFAULT 0 COMMENT '接收到的timestamp秒级存储毫秒时间戳' AFTER `rm_uid`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `cdr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'data JSON String' AFTER `timestamp`;
ALTER TABLE `cdr_event_sgwc` MODIFY COLUMN `created_at` bigint(20) NULL DEFAULT 0 COMMENT '记录创建存储毫秒' AFTER `cdr_json`;
ALTER TABLE `cdr_event_sgwc` ADD INDEX `idx_sgwc_uid_t`(`rm_uid`, `timestamp`) USING BTREE;

SET FOREIGN_KEY_CHECKS = 1;
