ALTER TABLE `n_sensor`
ADD COLUMN `ip` VARCHAR(45) NULL AFTER `order_num`,
ADD COLUMN `port` INT NULL AFTER `ip`,
ADD COLUMN `username` VARCHAR(45) NULL AFTER `port`,
ADD COLUMN `passwd` VARCHAR(45) NULL AFTER `username`,
ADD COLUMN `tm_id` INT NULL AFTER `passwd`,
ADD COLUMN `tm_type` INT NULL AFTER `tm_id`;

CREATE TABLE `thermal_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) DEFAULT NULL COMMENT '类型id',
  `maxtemp` varchar(45) DEFAULT NULL,
  `mintemp` varchar(45) DEFAULT NULL,
  `avertemp` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `data_eaif_h`;
CREATE TABLE `data_eaif_h` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自动编号',
  `eqmid` int(11) NOT NULL COMMENT '设备ID',
  `areaid` int(11) DEFAULT NULL COMMENT '点、线、区域ID',
  `capturetime` datetime NOT NULL COMMENT '采集时间',
  `maxtemp` float(18,4) DEFAULT NULL COMMENT '最大温度',
  `mintemp` float(18,4) DEFAULT NULL COMMENT '最小温度',
  `avgtemp` float(18,4) DEFAULT NULL COMMENT '平均温度',
  `unit` tinyint(2) DEFAULT NULL COMMENT '1=>摄氏度2=>华氏度',
  `type` tinyint(2) DEFAULT NULL COMMENT '1->点2->线3->框',
  `mid` float(10,4) DEFAULT NULL COMMENT '中间差',
  `std` float(10,4) DEFAULT NULL COMMENT '标准方差值',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx` (`eqmid`,`capturetime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='红外区域测温数据表';