CREATE TABLE `bots` (
  `nick` varchar(30) NOT NULL,
  `user` varchar(10) NOT NULL DEFAULT 'erebus',
  `bind` varchar(15) DEFAULT NULL,
  `authname` varchar(30) DEFAULT NULL,
  `authpass` varchar(20) DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `connected` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`nick`)
);
CREATE TABLE `chans` (
  `chname` varchar(100) NOT NULL,
  `bot` varchar(30) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`chname`)
);
CREATE INDEX chans_bot ON chans (bot);
CREATE TABLE `chusers` (
  `chan` varchar(100) NOT NULL,
  `user` varchar(30) NOT NULL,
  `level` int(11) NOT NULL,
  PRIMARY KEY (`chan`,`user`)
);
CREATE TABLE `users` (
  `auth` varchar(30) NOT NULL,
  `level` tinyint(3) NOT NULL,
  PRIMARY KEY (`auth`)
);
