CREATE TABLE IF NOT EXISTS `config` (
 `config_name` VARCHAR(50) DEFAULT NULL,
 `config_value` TEXT,
 `id` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 ;
INSERT INTO `config` (`config_name`, `config_value`, `id`) VALUES
	('dbver', '7', 1),
	('updateinterval', '60', 2),
	('ContactInfo', 'Enter your contact info here.....', 3),
	('ContactEmail', 'mail@null.com', 4),
	('maxfilesize', '102400', 5),
	('extension', '.txt', 6),
	('extension', '.ini', 7),
	('extension', '.cfg', 8),
	('extension', '.log', 9),
	('bccemail', 'masher@brainless.us', 10),
	('ReminderMessage', 'Reminder:  The payment for your game server, %ServerName%, is due %DueDate%.\r\n\r\nTo ensure uninterrupted service please send your payment of $%PaymentAmount% as soon as possible.\r\n\r\nThanks for your business!\r\n\r\nNote:  This is an automated message and may not reflect your current account status.  If you`ve already paid you can disregard this message.', 11),
	('ReminderSubject', 'Gameserver Payment Reminder', 12),
	('SMTPserver', 'mail.null.com', 13),
	('fromemail', '"Game Servers"<mail@null.com>', 14);

CREATE TABLE IF NOT EXISTS `groups` (
  `gid` int NOT NULL AUTO_INCREMENT,
  `name` text ,
  `description` text ,
  PRIMARY KEY (`gid`)
) ENGINE=InnoDB ;

CREATE TABLE IF NOT EXISTS `group_members` (
  `gid` double DEFAULT NULL,
  `uid` double DEFAULT NULL,
  `id` int NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB ;

CREATE TABLE IF NOT EXISTS `group_perms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `gid` double DEFAULT NULL,
  `sid` double DEFAULT NULL,
  `perm` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`)
) ENGINE=InnoDB ;

CREATE TABLE IF NOT EXISTS `serverdef` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` text NOT NULL,
  `ip` text NOT NULL,
  `port` text NOT NULL,
  `secret` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 ;

INSERT INTO `serverdef` (`id`, `name`, `ip`, `port`, `secret`) VALUES
	(1, 'This Host', '', '', '');

CREATE TABLE IF NOT EXISTS `servers` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user` int DEFAULT '0',
  `friendlyname` varchar(100) DEFAULT NULL,
  `startpath` text ,
  `cmd` text ,
  `cmdhash` varchar(50) DEFAULT NULL,
  `args` text ,
  `hiddenargs` text ,
  `editargs` int DEFAULT '0',
  `pid` int DEFAULT '0',
  `type` varchar(50) DEFAULT NULL,
  `allowupdate` int DEFAULT '0',
  `updcmd` text ,
  `updargs` text ,
  `fedit` int DEFAULT '0',
  `fpath` text ,
  `lastupdate` text ,
  `qryip` varchar(50) DEFAULT NULL,
  `qryport` int DEFAULT '0',
  `admin_notes` text ,
  `user_notes` text ,
  `autorestart` int DEFAULT '0',
  `nostart` int DEFAULT '0',
  `extracmd` text ,
  `extralbl` text ,
  `extraargs` text ,
  `priority` int DEFAULT '0',
  `cpuafin` int DEFAULT '0',
  `duedate` text ,
  `amountdue` text ,
  `img` text ,
  `sdefid` int NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB ;

CREATE TABLE IF NOT EXISTS `tickmon` (
  `id` int NOT NULL AUTO_INCREMENT,
  `ini` varchar(50) DEFAULT NULL,
  `net` int DEFAULT '0',
  `tick` int DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `id` (`id`)
) ENGINE=InnoDB ;

CREATE TABLE IF NOT EXISTS `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user` varchar(50) DEFAULT NULL,
  `password` varchar(50) DEFAULT NULL,
  `admin` tinyint DEFAULT '0',
  `god` tinyint DEFAULT '0',
  `enabled` tinyint DEFAULT '0',
  `email` text ,
  `info` text ,
  `maxsrvrs` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 ;

INSERT INTO `users` (`id`, `user`, `password`, `admin`, `god`, `enabled`, `email`, `info`, `maxsrvrs`) VALUES
	(1, 'admin', 'admin', 1, 1, 1, 'youremail@null.com', '', 0);
