## SVN $Id$

CREATE TABLE `attachment` (
  `attachmentid` int(10) unsigned NOT NULL auto_increment,
  `bugid` int(10) unsigned NOT NULL default '0',
  `filename` varchar(255) NOT NULL default '',
  `mimetype` varchar(255) NOT NULL default '',
  `filesize` int(20) unsigned NOT NULL default '0',
  `attachment` mediumblob NOT NULL,
  `description` varchar(255) NOT NULL default '',
  `dateline` int(20) unsigned NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL default '0',
  `obsolete` int(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (`attachmentid`)
) ENGINE=MyISAM;

CREATE TABLE `autoaction` (
  `actionid` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  `description` mediumtext NOT NULL,
  `fieldchanges` mediumtext NOT NULL,
  `comment` mediumtext NOT NULL,
  PRIMARY KEY  (`actionid`)
) ENGINE=MyISAM;

CREATE TABLE `bug` (
  `bugid` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `dateline` int(20) unsigned NOT NULL default '0',
  `productid` int(10) unsigned NOT NULL default '0',
  `componentid` int(10) unsigned NOT NULL default '0',
  `versionid` int(10) unsigned NOT NULL default '0',
  `summary` varchar(255) NOT NULL default '',
  `priority` int(10) unsigned NOT NULL default '0',
  `severity` int(10) unsigned NOT NULL default '0',
  `status` int(10) unsigned NOT NULL default '0',
  `resolution` int(10) unsigned NOT NULL default '0',
  `assignedto` int(10) unsigned NOT NULL default '0',
  `duplicateof` int(10) unsigned NOT NULL default '0',
  `dependency` mediumtext NOT NULL,
  `hidden` int(2) unsigned NOT NULL default '0',
  `initialreport` int(10) unsigned NOT NULL default '0',
  `lastposttime` int(20) unsigned NOT NULL default '0',
  `lastpostby` int(10) unsigned NOT NULL default '0',
  `hiddenlastposttime` int(10) unsigned NOT NULL default '0',
  `hiddenlastpostby` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`bugid`),
  FULLTEXT KEY `summary` (`summary`)
) ENGINE=MyISAM;

CREATE TABLE `bugfield` (
  `fieldid` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  `description` mediumtext NOT NULL,
  `type` varchar(50) NOT NULL default '',
  `selects` mediumtext NOT NULL,
  `required` int(2) NOT NULL default '0',
  `cansearch` int(2) NOT NULL default '0',
  `regexmatch` mediumtext NOT NULL,
  `defaultvalue` mediumtext NOT NULL,
  `usedefault` int(2) NOT NULL default '0',
  `maxlength` int(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`fieldid`)
) ENGINE=MyISAM;

CREATE TABLE `bugfieldpermission` (
  `usergroupid` int(10) unsigned NOT NULL default '0',
  `fieldid` int(10) unsigned NOT NULL default '0',
  `mask` int(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`usergroupid`,`fieldid`)
) ENGINE=MyISAM;

CREATE TABLE `bugvaluefill` (
  `bugid` int(10) unsigned NOT NULL default '0',
  `field2` mediumtext,
  `field4` mediumtext,
  `field5` mediumtext,
  PRIMARY KEY  (`bugid`)
) ENGINE=MyISAM;

CREATE TABLE `comment` (
  `commentid` int(10) unsigned NOT NULL auto_increment,
  `bugid` int(10) unsigned NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL default '0',
  `dateline` int(20) unsigned NOT NULL default '0',
  `comment` mediumtext NOT NULL,
  `comment_parsed` mediumtext NOT NULL,
  `hidden` int(2) unsigned NOT NULL default '0',
  PRIMARY KEY  (`commentid`),
  FULLTEXT KEY `comment` (`comment`)
) ENGINE=MyISAM;

CREATE TABLE `datastore` (
  `title` varchar(255) NOT NULL default '',
  `data` mediumtext NOT NULL,
  PRIMARY KEY  (`title`)
) ENGINE=MyISAM;

CREATE TABLE `dependency` (
  `dependencyid` int(10) unsigned NOT NULL auto_increment,
  `bugid` int(10) unsigned NOT NULL default '0',
  `dependson` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`dependencyid`)
) ENGINE=MyISAM;

CREATE TABLE `favourite` (
  `userid` int(10) unsigned NOT NULL default '0',
  `bugid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`userid`,`bugid`)
) ENGINE=MyISAM;

CREATE TABLE `history` (
  `historyid` int(20) unsigned NOT NULL auto_increment,
  `bugid` int(10) unsigned NOT NULL default '0',
  `attachmentid` int(10) unsigned NOT NULL default '0',
  `commentid` int(10) unsigned NOT NULL default '0',
  `dateline` int(20) unsigned NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL default '0',
  `field` varchar(255) NOT NULL default '',
  `original` mediumtext NOT NULL,
  `changed` mediumtext NOT NULL,
  PRIMARY KEY  (`historyid`)
) ENGINE=MyISAM;

CREATE TABLE `language` (
  `languageid` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `languagecode` varchar(5) NOT NULL default '',
  `charset` varchar(15) NOT NULL default '',
  `direction` char(3) NOT NULL default '',
  `filename` varchar(255) NOT NULL default '',
  `default` int(2) unsigned NOT NULL default '0',
  `userselect` int(2) unsigned NOT NULL default '0',
  `debug` int(2) unsigned NOT NULL default '0',
  PRIMARY KEY  (`languageid`),
  UNIQUE KEY `languagecode` (`languagecode`)
) ENGINE=MyISAM;

CREATE TABLE `localization` (
  `localid` int(10) unsigned NOT NULL auto_increment,
  `localkey` mediumtext NOT NULL,
  `localtext` mediumtext NOT NULL,
  `languageid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`localid`)
) ENGINE=MyISAM;

CREATE TABLE `permission` (
  `usergroupid` int(10) unsigned NOT NULL default '0',
  `productid` int(10) unsigned NOT NULL default '0',
  `mask` int(5) NOT NULL default '0',
  PRIMARY KEY  (`usergroupid`,`productid`)
) ENGINE=MyISAM;

CREATE TABLE `priority` (
  `priorityid` int(10) unsigned NOT NULL auto_increment,
  `priority` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`priorityid`)
) ENGINE=MyISAM;

CREATE TABLE `product` (
  `productid` int(10) unsigned NOT NULL auto_increment,
  `componentmother` int(10) unsigned NOT NULL default '0',
  `shortname` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  `title` varchar(255) NOT NULL default '',
  `description` mediumtext NOT NULL,
  PRIMARY KEY  (`productid`)
) ENGINE=MyISAM;

CREATE TABLE `resolution` (
  `resolutionid` int(10) unsigned NOT NULL auto_increment,
  `resolution` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`resolutionid`)
) ENGINE=MyISAM;

CREATE TABLE `search` (
  `userid` int(10) unsigned NOT NULL default '0',
  `dateline` int(20) unsigned NOT NULL default '0',
  `query` mediumtext NOT NULL,
  `ids` mediumtext NOT NULL,
  `orderby` mediumtext NOT NULL,
  `hilight` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM;

CREATE TABLE `setting` (
  `varname` varchar(255) NOT NULL default '',
  `value` mediumtext NOT NULL,
  PRIMARY KEY  (`varname`)
) ENGINE=MyISAM;

CREATE TABLE `severity` (
  `severityid` int(10) unsigned NOT NULL auto_increment,
  `severity` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`severityid`)
) ENGINE=MyISAM;

CREATE TABLE `status` (
  `statusid` int(10) unsigned NOT NULL auto_increment,
  `status` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  `color` varchar(10) NOT NULL default '',
  PRIMARY KEY  (`statusid`)
) ENGINE=MyISAM;

CREATE TABLE `user` (
  `userid` int(10) unsigned NOT NULL auto_increment,
  `email` varchar(255) NOT NULL default '',
  `displayname` varchar(255) NOT NULL default '',
  `usergroupid` int(10) unsigned NOT NULL default '0',
  `password` varchar(32) NOT NULL default '',
  `salt` varchar(15) NOT NULL default '',
  `authkey` varchar(65) NOT NULL default '',
  `showemail` int(2) unsigned NOT NULL default '0',
  `showcolours` int(2) unsigned NOT NULL default '0',
  `languageid` int(10) unsigned NOT NULL default '0',
  `timezone` int(4) NOT NULL default '0',
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM;

CREATE TABLE `useractivation` (
  `activator` varchar(25) NOT NULL default '',
  `userid` int(10) unsigned NOT NULL default '0',
  `dateline` int(10) unsigned NOT NULL default '0',
  `usergroupid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`activator`)
) ENGINE=MyISAM;

CREATE TABLE `usergroup` (
  `usergroupid` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `displaytitle` varchar(255) NOT NULL default '',
  `opentag` varchar(255) NOT NULL default '',
  `closetag` varchar(255) NOT NULL default '',
  `permissions` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`usergroupid`)
) ENGINE=MyISAM;

CREATE TABLE `version` (
  `versionid` int(10) unsigned NOT NULL auto_increment,
  `productid` int(10) unsigned NOT NULL default '0',
  `version` varchar(255) NOT NULL default '',
  `displayorder` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`versionid`)
) ENGINE=MyISAM;

CREATE TABLE `vote` (
  `bugid` int(10) unsigned NOT NULL default '0',
  `userids` mediumtext NOT NULL,
  `votefor` int(10) unsigned NOT NULL default '0',
  `voteagainst` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`bugid`)
) ENGINE=MyISAM;