dump.sql 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. CREATE TABLE IF NOT EXISTS `mlg_acct` (
  2. `radacctid` bigint(21) NOT NULL AUTO_INCREMENT,
  3. `acctsessionid` varchar(64) NOT NULL DEFAULT '',
  4. `acctuniqueid` varchar(32) NOT NULL DEFAULT '',
  5. `username` varchar(64) NOT NULL DEFAULT '',
  6. `groupname` varchar(64) NOT NULL DEFAULT '',
  7. `realm` varchar(64) DEFAULT '',
  8. `nasipaddress` varchar(15) NOT NULL DEFAULT '',
  9. `nasportid` varchar(120) DEFAULT NULL,
  10. `nasporttype` varchar(32) DEFAULT NULL,
  11. `acctstarttime` datetime DEFAULT NULL,
  12. `acctstoptime` datetime DEFAULT NULL,
  13. `acctsessiontime` int(12) DEFAULT NULL,
  14. `acctauthentic` varchar(32) DEFAULT NULL,
  15. `connectinfo_start` varchar(50) DEFAULT NULL,
  16. `connectinfo_stop` varchar(50) DEFAULT NULL,
  17. `acctinputoctets` bigint(20) DEFAULT NULL,
  18. `acctoutputoctets` bigint(20) DEFAULT NULL,
  19. `calledstationid` varchar(50) NOT NULL DEFAULT '',
  20. `callingstationid` varchar(50) NOT NULL DEFAULT '',
  21. `acctterminatecause` varchar(32) NOT NULL DEFAULT '',
  22. `servicetype` varchar(32) DEFAULT NULL,
  23. `framedprotocol` varchar(32) DEFAULT NULL,
  24. `framedipaddress` varchar(15) NOT NULL DEFAULT '',
  25. `acctstartdelay` int(12) DEFAULT NULL,
  26. `acctstopdelay` int(12) DEFAULT NULL,
  27. `xascendsessionsvrkey` varchar(10) DEFAULT NULL,
  28. PRIMARY KEY (`radacctid`),
  29. UNIQUE KEY `acctuniqueid` (`acctuniqueid`),
  30. KEY `username` (`username`),
  31. KEY `framedipaddress` (`framedipaddress`),
  32. KEY `acctsessionid` (`acctsessionid`),
  33. KEY `acctsessiontime` (`acctsessiontime`),
  34. KEY `acctstarttime` (`acctstarttime`),
  35. KEY `acctstoptime` (`acctstoptime`),
  36. KEY `nasipaddress` (`nasipaddress`)
  37. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  38. CREATE TABLE IF NOT EXISTS `mlg_postauth` (
  39. `id` int(11) NOT NULL AUTO_INCREMENT,
  40. `username` varchar(64) NOT NULL default '',
  41. `pass` varchar(64) NOT NULL default '',
  42. `reply` varchar(32) NOT NULL default '',
  43. `authdate` timestamp NOT NULL,
  44. PRIMARY KEY (`id`)
  45. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  46. CREATE TABLE IF NOT EXISTS `mlg_nascustom` (
  47. `id` int(11) NOT NULL AUTO_INCREMENT,
  48. `ip` varchar(32) NOT NULL,
  49. `name` varchar(64) NOT NULL,
  50. `secret` varchar(64) NOT NULL,
  51. PRIMARY KEY (`id`)
  52. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  53. -- old-view without custom NASes
  54. -- CREATE OR REPLACE VIEW `mlg_clients` (`nasname`, `shortname`, `type`, `ports`, `secret`, `server`) AS
  55. -- SELECT DISTINCT `nasip` AS `nasname`,`nasname` AS `shortname`,'other' AS `type`,NULL AS `ports`,left(md5(inet_aton(`nasip`)),12) AS `secret`,NULL AS `server` from `nas` GROUP BY `nasip`;
  56. CREATE OR REPLACE VIEW `mlg_clients` (`nasname`, `shortname`, `type`, `ports`, `secret`, `server`) AS
  57. SELECT DISTINCT
  58. COALESCE(mlg_nascustom.ip, nas.`nasip`, NULL) AS `nasname`,
  59. COALESCE(mlg_nascustom.name, nas.`nasname`, NULL) AS `shortname`,
  60. 'other' AS `type`,
  61. NULL AS `ports`,
  62. COALESCE(mlg_nascustom.secret, left(md5(inet_aton(nas.`nasip`)),12), NULL) AS `secret`,
  63. NULL AS `server`
  64. from `nas`
  65. left join mlg_nascustom on (nas.nasip = mlg_nascustom.ip)
  66. GROUP BY nasname
  67. UNION SELECT DISTINCT
  68. `ip` AS `nasname`,
  69. `name` AS `shortname`,
  70. 'other' AS `type`,
  71. NULL AS `ports`,
  72. `secret` as `secret`,
  73. NULL as `server`
  74. from `mlg_nascustom`
  75. LEFT JOIN nas ON (mlg_nascustom.ip = nas.nasip)
  76. where nasname is null
  77. GROUP BY `ip`;
  78. CREATE TABLE IF NOT EXISTS `mlg_check` (
  79. id int(11) unsigned NOT NULL auto_increment,
  80. username varchar(64) NOT NULL default '',
  81. attribute varchar(64) NOT NULL default '',
  82. op char(2) NOT NULL DEFAULT '==',
  83. value varchar(253) NOT NULL default '',
  84. PRIMARY KEY (id),
  85. KEY username (username(32))
  86. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  87. CREATE TABLE IF NOT EXISTS `mlg_reply` (
  88. id int(11) unsigned NOT NULL auto_increment,
  89. username varchar(64) NOT NULL default '',
  90. attribute varchar(64) NOT NULL default '',
  91. op char(2) NOT NULL DEFAULT '=',
  92. value varchar(253) NOT NULL default '',
  93. PRIMARY KEY (id),
  94. KEY username (username(32))
  95. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  96. CREATE TABLE IF NOT EXISTS mlg_groupcheck (
  97. id int(11) unsigned NOT NULL auto_increment,
  98. groupname varchar(64) NOT NULL default '',
  99. attribute varchar(64) NOT NULL default '',
  100. op char(2) NOT NULL DEFAULT '==',
  101. value varchar(253) NOT NULL default '',
  102. PRIMARY KEY (id),
  103. KEY groupname (groupname(32))
  104. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  105. CREATE TABLE IF NOT EXISTS mlg_groupreply (
  106. id int(11) unsigned NOT NULL auto_increment,
  107. groupname varchar(64) NOT NULL default '',
  108. attribute varchar(64) NOT NULL default '',
  109. op char(2) NOT NULL DEFAULT '=',
  110. value varchar(253) NOT NULL default '',
  111. PRIMARY KEY (id),
  112. KEY groupname (groupname(32))
  113. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  114. CREATE TABLE IF NOT EXISTS mlg_usergroup (
  115. username varchar(64) NOT NULL default '',
  116. groupname varchar(64) NOT NULL default '',
  117. priority int(11) NOT NULL default '1',
  118. KEY username (username(32))
  119. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  120. CREATE TABLE IF NOT EXISTS `mlg_nasattributes` (
  121. `id` int(11) NOT NULL AUTO_INCREMENT,
  122. `nasid` int(11) NOT NULL,
  123. `scenario` varchar(30) NOT NULL,
  124. `attribute` varchar(255) NOT NULL,
  125. `operator` varchar(10) NOT NULL,
  126. `content` varchar(255) NOT NULL,
  127. PRIMARY KEY (`id`),
  128. KEY `nasid` (`nasid`,`scenario`)
  129. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  130. CREATE TABLE IF NOT EXISTS `mlg_nasoptions` (
  131. `id` int(11) NOT NULL AUTO_INCREMENT,
  132. `nasid` int(11) NOT NULL,
  133. `usernametype` varchar(30) NOT NULL,
  134. `service` varchar(255) NOT NULL,
  135. `onlyactive` int(11) NOT NULL,
  136. PRIMARY KEY (`id`),
  137. KEY `nasid` (`nasid`,`usernametype`)
  138. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  139. CREATE TABLE IF NOT EXISTS `mlg_services` (
  140. `id` int(11) NOT NULL AUTO_INCREMENT,
  141. `nasid` int(11) NOT NULL,
  142. `pod` TEXT default NULL,
  143. `coaconnect` TEXT default NULL,
  144. `coadisconnect` TEXT default NULL,
  145. PRIMARY KEY (`id`),
  146. KEY `nasid` (`nasid`)
  147. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  148. CREATE TABLE IF NOT EXISTS `mlg_userstates` (
  149. `id` int(11) NOT NULL AUTO_INCREMENT,
  150. `login` varchar(64) NOT NULL,
  151. `state` int(11) NOT NULL,
  152. PRIMARY KEY (`id`)
  153. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  154. ALTER TABLE `mlg_nasattributes` ADD `modifier` VARCHAR(15) NOT NULL DEFAULT 'all' AFTER `scenario`;
  155. ALTER TABLE `mlg_nasoptions` ADD `port` INT(11) NOT NULL DEFAULT '3799' AFTER `onlyactive`;
  156. drop table `mlg_groupreply`;
  157. CREATE TABLE IF NOT EXISTS `mlg_groupreply` (
  158. id int(11) unsigned NOT NULL auto_increment,
  159. username varchar(64) NOT NULL default '',
  160. attribute varchar(64) NOT NULL default '',
  161. op char(2) NOT NULL DEFAULT '=',
  162. value varchar(253) NOT NULL default '',
  163. PRIMARY KEY (id),
  164. KEY username (username(32))
  165. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  166. CREATE TABLE IF NOT EXISTS `mlg_traffic` (
  167. `login` varchar(100) NOT NULL,
  168. `down` bigint(30) DEFAULT NULL,
  169. `up` bigint(30) DEFAULT NULL,
  170. `act` int(11) DEFAULT NULL,
  171. PRIMARY KEY (`login`)
  172. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;