SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for kpi_c_report_mme
-- ----------------------------
CREATE TABLE IF NOT EXISTS `kpi_c_report_mme` (
  `id` int NOT NULL AUTO_INCREMENT,
  `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `ne_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
  `date` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss',
  `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Start time of the report hh:mi:ss',
  `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'End time of the report hh:mi:ss',
  `index` int NOT NULL COMMENT 'Index of the report',
  `granularity` int DEFAULT '60' COMMENT 'Time granualarity: 5/10/.../60/300 (second)',
  `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT 'KPI values JSON String',
  `created_at` bigint DEFAULT '0' COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_c_mme_uid_at` (`rm_uid`,`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='KPI_自定义指标数据_MME';

-- ----------------------------
-- COLUMN for kpi_c_report_mme
-- ----------------------------
ALTER TABLE `kpi_c_report_mme` DROP INDEX `idx_timestamp`;
ALTER TABLE `kpi_c_report_mme` DROP INDEX `idx_uid_datetime`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `ne_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' AFTER `id`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `rm_uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' AFTER `ne_name`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `date` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Date of the report yyyy-mm-dd hh:mi:ss' AFTER `rm_uid`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `start_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'Start time of the report hh:mi:ss' AFTER `date`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `end_time` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'End time of the report hh:mi:ss' AFTER `start_time`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `index` int(11) NOT NULL COMMENT 'Index of the report' AFTER `end_time`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `granularity` int(11) NULL DEFAULT 60 COMMENT 'Time granualarity: 5/10/.../60/300 (second)' AFTER `index`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `kpi_values` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT 'KPI values JSON String' AFTER `granularity`;
ALTER TABLE `kpi_c_report_mme` MODIFY COLUMN `created_at` bigint(20) NULL DEFAULT 0 COMMENT 'Creation time 接收到的timestamp秒级存储毫秒时间戳' AFTER `kpi_values`;
ALTER TABLE `kpi_c_report_mme` ADD INDEX `idx_c_mme_uid_at`(`rm_uid`, `created_at`) USING BTREE;
ALTER TABLE `kpi_c_report_mme` COMMENT = 'KPI_自定义指标数据_MME';

SET FOREIGN_KEY_CHECKS = 1;
