DROP TABLE IF EXISTS `rm_onlineradius`;
CREATE TABLE `rm_onlineradius` (
  `rtt` decimal(11,1) DEFAULT NULL,
  `loss` int(3) DEFAULT NULL,
  `username` varchar(64) NOT NULL DEFAULT '',
  `cid` varchar(50) NOT NULL DEFAULT '',
  `cpeip` varchar(15) NOT NULL DEFAULT '',
  KEY `cpeip` (`cpeip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `rm_wlan`;
DROP TABLE IF EXISTS `rm_wlan1`;

CREATE TABLE `rm_wlan` (
  `maccpe` varchar(17) DEFAULT NULL,
  `uspwr` smallint(6) DEFAULT NULL,
  `ccq` smallint(6) DEFAULT NULL,
  `snr` smallint(6) DEFAULT NULL,
  `apip` varchar(15) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  KEY `maccpe` (`maccpe`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `rm_wlantmp` (
  `maccpe` varchar(17) DEFAULT NULL,
  `uspwr` smallint(6) DEFAULT NULL,
  `ccq` smallint(6) DEFAULT NULL,
  `snr` smallint(6) DEFAULT NULL,
  `apip` varchar(15) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  KEY `maccpe` (`maccpe`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `rm_onlinecm`;
DROP TABLE IF EXISTS `rm_onlinecm1`;

CREATE TABLE `rm_onlinecm` (
  `username` varchar(64) NOT NULL DEFAULT '',
  `maccm` varchar(17) DEFAULT NULL,
  `enableuser` tinyint(1) DEFAULT NULL,
  `staticipcm` varchar(15) DEFAULT NULL,
  `maccpe` varchar(17) DEFAULT NULL,
  `ipcpe` varchar(15) DEFAULT NULL,
  `ipmodecpe` tinyint(1) DEFAULT NULL,
  `cmtsid` int(11) DEFAULT NULL,
  `groupid` int(11) DEFAULT NULL,
  `groupname` varchar(50) DEFAULT NULL,
  `dlbytes` bigint(20) DEFAULT NULL,
  `ulbytes` bigint(20) DEFAULT NULL,
  `snrds` decimal(11,1) DEFAULT NULL,
  `snrus` decimal(11,1) DEFAULT NULL,
  `txpwr` decimal(11,1) DEFAULT NULL,
  `rxpwr` decimal(11,1) DEFAULT NULL,
  `pingtime` decimal(11,1) DEFAULT NULL,
  `uptime` varchar(30) DEFAULT NULL,
  `loss` int(3) DEFAULT NULL,
  `dsname` varchar(50) DEFAULT NULL,
  `usname` varchar(50) DEFAULT NULL,
  `dsifidx` int(11) DEFAULT NULL,
  `usifidx` int(11) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`username`),
  KEY `maccm` (`maccm`),
  KEY `staticipcm` (`staticipcm`),
  KEY `ipcpe` (`ipcpe`),
  KEY `groupname` (`groupname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `rm_onlinecmtmp` (
  `username` varchar(64) NOT NULL DEFAULT '',
  `maccm` varchar(17) DEFAULT NULL,
  `enableuser` tinyint(1) DEFAULT NULL,
  `staticipcm` varchar(15) DEFAULT NULL,
  `maccpe` varchar(17) DEFAULT NULL,
  `ipcpe` varchar(15) DEFAULT NULL,
  `ipmodecpe` tinyint(1) DEFAULT NULL,
  `cmtsid` int(11) DEFAULT NULL,
  `groupid` int(11) DEFAULT NULL,
  `groupname` varchar(50) DEFAULT NULL,
  `dlbytes` bigint(20) DEFAULT NULL,
  `ulbytes` bigint(20) DEFAULT NULL,
  `snrds` decimal(11,1) DEFAULT NULL,
  `snrus` decimal(11,1) DEFAULT NULL,
  `txpwr` decimal(11,1) DEFAULT NULL,
  `rxpwr` decimal(11,1) DEFAULT NULL,
  `pingtime` decimal(11,1) DEFAULT NULL,
  `uptime` varchar(30) DEFAULT NULL,
  `loss` int(3) DEFAULT NULL,
  `dsname` varchar(50) DEFAULT NULL,
  `usname` varchar(50) DEFAULT NULL,
  `dsifidx` int(11) DEFAULT NULL,
  `usifidx` int(11) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`username`),
  KEY `maccm` (`maccm`),
  KEY `staticipcm` (`staticipcm`),
  KEY `ipcpe` (`ipcpe`),
  KEY `groupname` (`groupname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
