-- Database: spitfire
-- Database Version: 1.2


CREATE TABLE IF NOT EXISTS `config` (
  `id` int(11) NOT NULL auto_increment,
  `section` varchar(100) NOT NULL default '',
  `name` varchar(100) NOT NULL default '',
  `value` text NOT NULL,
  `status` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `section` (`section`),
  KEY `name` (`name`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `element` (
  `id` int(11) NOT NULL auto_increment,
  `group_id` int(11) NOT NULL default '0',
  `name` varchar(100) NOT NULL default '',
  `status` tinyint(4) NOT NULL default '0',
  `text` text NOT NULL,
  `ticket_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `group_id` (`group_id`),
  FULLTEXT KEY `text` (`text`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `group` (
  `id` int(11) NOT NULL auto_increment,
  `parent_group_id` int(11) NOT NULL default '0',
  `link_group_id` int(11) NOT NULL default '0',
  `link_group_name` varchar(100) NOT NULL default '',
  `online_group_id` int(11) NOT NULL default '0',
  `timer_id` int(11) NOT NULL default '0',
  `name` varchar(100) NOT NULL default '',
  `status` tinyint(4) NOT NULL default '0',
  `edit_groups` varchar(100) NOT NULL default '',
  `sequence_id` int(11) NOT NULL default '0',
  `url` varchar(255) NOT NULL default '',
  `ticket_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `parent_group_id` (`parent_group_id`),
  KEY `link_group_id` (`link_group_id`),
  KEY `online_group_id` (`online_group_id`),
  KEY `sequence_id` (`sequence_id`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `history` (
  `id` int(11) NOT NULL auto_increment,
  `ticket_id` int(11) NOT NULL default '0',
  `user_id` int(11) NOT NULL default '0',
  `gid` int(11) NOT NULL default '0',
  `name` varchar(100) NOT NULL default '',
  `time` datetime NOT NULL default '0000-01-01 00:00:00',
  `status` tinyint(4) NOT NULL default '0',
  `table_name` varchar(10) NOT NULL default '',
  `row_id` int(11) NOT NULL default '0',
  `row_values` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `user_id` (`user_id`),
  KEY `row_id` (`row_id`),
  KEY `table_name` (`table_name`),
  KEY `time` (`time`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `i18n` (
  `id` int(11) NOT NULL auto_increment,
  `language` char(2) NOT NULL default '',
  `section` varchar(20) NOT NULL default '',
  `name` varchar(100) NOT NULL default '',
  `value` text NOT NULL,
  `status` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `section` (`section`),
  KEY `name` (`name`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `sequence` (
  `id` int(11) NOT NULL auto_increment,
  `sequence` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `ticket` (
  `id` int(11) NOT NULL auto_increment,
  `user_id` int(11) NOT NULL default '0',
  `timer_id` int(11) NOT NULL default '0',
  `name` varchar(100) NOT NULL default '',
  `status` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `timer` (
  `id` int(11) NOT NULL auto_increment,
  `time` datetime NOT NULL default '0000-01-01 00:00:00',
  `status` tinyint(4) NOT NULL default '0',
  `ticket_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `time` (`time`)
) ENGINE=MyISAM;

CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL auto_increment,
  `realname` varchar(100) NOT NULL default '',
  `username` varchar(20) NOT NULL default '',
  `password` varchar(32) NOT NULL default '',
  `groups` varchar(100) NOT NULL default '',
  `may_edit_users` char(1) NOT NULL default '',
  `is_admin` char(1) NOT NULL default '',
  `status` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

INSERT IGNORE INTO `config` VALUES (1, 'db', 'version', '1.2', 1);
INSERT IGNORE INTO `config` VALUES (2, 'ticket', 'use tickets', '0', 1);
INSERT IGNORE INTO `config` VALUES (3, 'system', 'maxFilesize', '1000', 1);
INSERT IGNORE INTO `config` VALUES (4, 'system', 'maxImagesize', '100', 1);
INSERT IGNORE INTO `config` VALUES (5, 'system', 'historyTime', '60', 1);
INSERT IGNORE INTO `config` VALUES (6, 'user/1', 'must_change_password', '1', 1);


-- Data

INSERT IGNORE INTO `ticket` VALUES (1, 0, 0, 'Default', 1);

INSERT IGNORE INTO `user` VALUES (1, 'Administrator', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'all+', '1', '1', 0);
