

-- ----------------------------
-- Table structure for sync_tables_info
-- ----------------------------
DROP TABLE IF EXISTS `sync_tables_info`;
CREATE TABLE `sync_tables_info`  (
  `client_id` int UNSIGNED NOT NULL,
  `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `sql` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `devid_field_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `outer_devid_fname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `field_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `field_type` tinyint NOT NULL DEFAULT 1 COMMENT '1: 整数 2: 字符串 3: 日期 4: 浮点数',
  `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`client_id`, `table_name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of sync_tables_info
-- ----------------------------
INSERT INTO `sync_tables_info` VALUES (10, 'data_eaif_h', 'SELECT t2.equipmentid , t2.sensorid,t1.capturetime,t1.maxtemp,t1.mintemp,t1.avgtemp,t2.`Phase` FROM `data_eaif_h` AS t1 JOIN i2relation AS t2 ON t1.eqmid=t2.eqmid WHERE t1.eqmid=? AND t1.capturetime>? ORDER BY t1.capturetime LIMIT 1000', 'eqmid', 'sensorid', 'd_time', 3, '2023-12-11 11:56:18');
INSERT INTO `sync_tables_info` VALUES (10, 'data_eia_h', 'SELECT t2.equipmentid, t2.sensorid,t1.d_time, t1.d_ct_1, t2.phase FROM `data_eia_h` AS t1 JOIN i2relation AS t2 ON t1.eqmid=t2.eqmid WHERE t1.eqmid=? AND t1.d_time>? ORDER BY t1.d_time LIMIT 1000', 'eqmid', 'sensorid', 'capturetime', 3, '2023-12-06 14:17:19');

DROP TABLE IF EXISTS `sync_fields_info`;
CREATE TABLE `sync_fields_info`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `client_id` int UNSIGNED NOT NULL,
  `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `field_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `field_type` tinyint UNSIGNED NOT NULL DEFAULT 0,
  `dest_field_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fields`(`client_id`, `table_name`, `field_name`) USING BTREE
);

-- ----------------------------
-- Records of sync_fields_info
-- ----------------------------
INSERT INTO `sync_fields_info` VALUES (10, 10, 'data_eaif_h', 'maxtemp', 4, 'MaxTemp');
INSERT INTO `sync_fields_info` VALUES (11, 10, 'data_eaif_h', 'mintemp', 4, 'MinTemp');
INSERT INTO `sync_fields_info` VALUES (12, 10, 'data_eaif_h', 'avgtemp', 4, 'avgtemp');
INSERT INTO `sync_fields_info` VALUES (13, 10, 'data_eaif_h', 'phase', 2, 'Phase');
INSERT INTO `sync_fields_info` VALUES (15, 10, 'data_eia_h', 'phase', 2, 'Phase');
INSERT INTO `sync_fields_info` VALUES (19, 10, 'data_eia_h', 'd_ct_1', 4, 'TotalCoreCurrent');

-- ----------------------------
-- Table structure for sync_records
-- ----------------------------
DROP TABLE IF EXISTS `sync_records`;
CREATE TABLE `sync_records`  (
  `client_id` int UNSIGNED NOT NULL,
  `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `devid_val` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `field_val1` bigint UNSIGNED NULL DEFAULT 0,
  `field_val2` datetime(0) NULL DEFAULT '2000-01-01 01:00:00',
  `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`client_id`, `table_name`, `devid_val`) USING BTREE
);

-- ----------------------------
-- Records of sync_records
-- ----------------------------
INSERT INTO `sync_records` VALUES (10, 'data_eaif_h', '165', 0, '2019-06-29 10:33:47', '2023-12-07 14:35:11');
INSERT INTO `sync_records` VALUES (10, 'data_eaif_h', '188', 0, '2019-06-29 10:33:53', '2023-12-07 14:35:11');
INSERT INTO `sync_records` VALUES (10, 'data_eaif_h', '189', 0, '2019-06-29 10:33:53', '2023-12-07 14:35:11');
INSERT INTO `sync_records` VALUES (10, 'data_eaif_h', '191', 0, '2019-06-29 10:33:53', '2023-12-07 14:35:11');
INSERT INTO `sync_records` VALUES (10, 'data_eaif_h', '197', 0, '2019-06-29 10:33:53', '2023-12-07 14:35:11');



