# MySQL dump 7.1
#
# Host: localhost    Database: bugs
#--------------------------------------------------------
# Server version	3.22.32

#
# Table structure for table 'attachments'
#
CREATE TABLE attachments (
  attach_id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  creation_ts timestamp(14),
  description mediumtext NOT NULL,
  mimetype mediumtext NOT NULL,
  ispatch tinyint(4),
  filename mediumtext NOT NULL,
  thedata longblob NOT NULL,
  submitter_id mediumint(9) DEFAULT '0' NOT NULL,
  PRIMARY KEY (attach_id)
);
create index index_41 on attachments (bug_id); 
create index index_42 on attachments (creation_ts);

#
# Table structure for table 'bugs'
#
CREATE TABLE bugs (
  bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
  groupset bigint(20) DEFAULT '0' NOT NULL,
  assigned_to mediumint(9) DEFAULT '0' NOT NULL,
  bug_file_loc text,
  bug_severity enum DEFAULT 'blocker' NOT NULL,
  bug_status enum DEFAULT 'UNCONFIRMED' NOT NULL,
  creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  delta_ts timestamp(14),
  short_desc mediumtext,
  op_sys enum DEFAULT 'All' NOT NULL,
  priority enum DEFAULT 'P1' NOT NULL,
  product varchar(64) DEFAULT '' NOT NULL,
  rep_platform enum,
  reporter mediumint(9) DEFAULT '0' NOT NULL,
  version varchar(16) DEFAULT '' NOT NULL,
  component varchar(50) DEFAULT '' NOT NULL,
  resolution enum DEFAULT '' NOT NULL,
  target_milestone varchar(20) DEFAULT '---' NOT NULL,
  qa_contact mediumint(9) DEFAULT '0' NOT NULL,
  status_whiteboard mediumtext NOT NULL,
  votes mediumint(9) DEFAULT '0' NOT NULL,
  keywords mediumtext NOT NULL,
  lastdiffed datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  everconfirmed tinyint(4) DEFAULT '0' NOT NULL,
  PRIMARY KEY (bug_id)
);
create index index_7 on bugs (assigned_to);
create index index_8 on bugs (creation_ts);
create index index_9 on bugs (delta_ts);
create index index_10 on bugs (bug_severity);
create index index_11 on bugs (bug_status);
create index index_12 on bugs (op_sys);
create index index_13 on bugs (priority);
create index index_14 on bugs (product);
create index index_15 on bugs (reporter);
create index index_16 on bugs (version);
create index index_17 on bugs (component);
create index index_18 on bugs (resolution);
create index index_19 on bugs (target_milestone); 
create index index_20 on bugs (qa_contact);
create index index_21 on bugs (votes);

#
# Table structure for table 'bugs_activity'
#
CREATE TABLE bugs_activity (
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  who mediumint(9) DEFAULT '0' NOT NULL,
  bug_when datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  fieldid mediumint(9) DEFAULT '0' NOT NULL,
  oldvalue tinytext,
  newvalue tinytext
);
create index index_43 on bugs_activity (bug_id); 
create index index_44 on bugs_activity (bug_when); 
create index index_45 on bugs_activity (fieldid);

#
# Table structure for table 'cc'
#
CREATE TABLE cc (
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  who mediumint(9) DEFAULT '0' NOT NULL
);
create index index_31 on cc (who);
create unique index index_32 on cc (bug_id,who);

#
# Table structure for table 'components'
#
CREATE TABLE components (
  value tinytext,
  program varchar(64),
  initialowner tinytext NOT NULL,
  initialqacontact tinytext NOT NULL,
  description mediumtext NOT NULL
);

#
# Table structure for table 'dependencies'
#
CREATE TABLE dependencies (
  blocked mediumint(9) DEFAULT '0' NOT NULL,
  dependson mediumint(9) DEFAULT '0' NOT NULL
);
create index index_34 on dependencies (blocked); 
create index index_35 on dependencies (dependson);

#
# Table structure for table 'duplicates'
#
CREATE TABLE duplicates (
  dupe_of mediumint(9) DEFAULT '0' NOT NULL,
  dupe mediumint(9) DEFAULT '0' NOT NULL,
  PRIMARY KEY (dupe)
);

#
# Table structure for table 'fielddefs'
#
CREATE TABLE fielddefs (
  fieldid mediumint(9) DEFAULT '0' NOT NULL auto_increment,
  name varchar(64) DEFAULT '' NOT NULL,
  description mediumtext NOT NULL,
  mailhead tinyint(4) DEFAULT '0' NOT NULL,
  sortkey smallint(6) DEFAULT '0' NOT NULL,
  PRIMARY KEY (fieldid)
);
create unique index index_28 on fielddefs (name); 
create index index_29 on fielddefs (sortkey);

#
# Table structure for table 'groups'
#
CREATE TABLE groups (
  bit bigint(20) DEFAULT '0' NOT NULL,
  name varchar(255) DEFAULT '' NOT NULL,
  description text NOT NULL,
  isbuggroup tinyint(4) DEFAULT '0' NOT NULL,
  userregexp tinytext NOT NULL
);
create unique index index_3 on groups (bit);
create unique index index_4 on groups (name);

#
# Table structure for table 'keyworddefs'
#
CREATE TABLE keyworddefs (
  id smallint(6) DEFAULT '0' NOT NULL,
  name varchar(64) DEFAULT '' NOT NULL,
  description mediumtext,
  PRIMARY KEY (id)
);
create unique index index_33 on keyworddefs (name);

#
# Table structure for table 'keywords'
#
CREATE TABLE keywords (
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  keywordid smallint(6) DEFAULT '0' NOT NULL
);
create index index_39 on keywords (keywordid); 
create unique index index_40 on keywords (bug_id, keywordid);

#
# Table structure for table 'logincookies'
#
CREATE TABLE logincookies (
  cookie mediumint(9) DEFAULT '0' NOT NULL auto_increment,
  userid mediumint(9) DEFAULT '0' NOT NULL,
  cryptpassword varchar(64),
  hostname varchar(128),
  lastused timestamp(14),
  PRIMARY KEY (cookie)
);
create index index_30 on logincookies (lastused);

#
# Table structure for table 'longdescs'
#
CREATE TABLE longdescs (
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  who mediumint(9) DEFAULT '0' NOT NULL,
  bug_when datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  thetext mediumtext
);
create index index_22 on longdescs (bug_id);
create index index_23 on longdescs (bug_when);

#
# Table structure for table 'milestones'
#
CREATE TABLE milestones (
  value varchar(20) DEFAULT '' NOT NULL,
  product varchar(64) DEFAULT '' NOT NULL,
  sortkey smallint(6) DEFAULT '0' NOT NULL,
);
create unique index index_24 on milestones (product, value);

#
# Table structure for table 'namedqueries'
#
CREATE TABLE namedqueries (
  userid mediumint(9) DEFAULT '0' NOT NULL,
  name varchar(64) DEFAULT '' NOT NULL,
  watchfordiffs tinyint(4) DEFAULT '0' NOT NULL,
  linkinfooter tinyint(4) DEFAULT '0' NOT NULL,
  query mediumtext NOT NULL
);
create unique index index_25 on namedqueries (userid, name);
create index index_26 on namedqueries (watchfordiffs);

#
# Table structure for table 'products'
#
CREATE TABLE products (
  product varchar(64),
  description mediumtext,
  milestoneurl tinytext NOT NULL,
  disallownew tinyint(4) DEFAULT '0' NOT NULL,
  votesperuser smallint(6) DEFAULT '0' NOT NULL,
  maxvotesperbug smallint(6) DEFAULT '10000' NOT NULL,
  votestoconfirm smallint(6) DEFAULT '0' NOT NULL,
  defaultmilestone varchar(20) DEFAULT '---' NOT NULL
);

#
# Table structure for table 'profiles'
#
CREATE TABLE profiles (
  userid mediumint(9) DEFAULT '0' NOT NULL auto_increment,
  login_name varchar(255) DEFAULT '' NOT NULL,
  password varchar(16),
  cryptpassword varchar(64),
  realname varchar(255),
  groupset bigint(20) DEFAULT '0' NOT NULL,
  emailnotification enum DEFAULT 'ExcludeSelfChanges' NOT NULL,
  disabledtext mediumtext NOT NULL,
  newemailtech tinyint(4) DEFAULT '0' NOT NULL,
  mybugslink tinyint(4) DEFAULT '1' NOT NULL,
  blessgroupset bigint(20) DEFAULT '0' NOT NULL,
  PRIMARY KEY (userid)
);
create unique index index_27 on profiles (login_name);

#
# Table structure for table 'profiles_activity'
#
CREATE TABLE profiles_activity (
  userid mediumint(9) DEFAULT '0' NOT NULL,
  who mediumint(9) DEFAULT '0' NOT NULL,
  profiles_when datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  fieldid mediumint(9) DEFAULT '0' NOT NULL,
  oldvalue tinytext,
  newvalue tinytext
);
create index index_0 on profiles_activity (userid); 
create index index_1 on profiles_activity (profiles_when); 
create index index_2 on profiles_activity (fieldid);

#
# Table structure for table 'shadowlog'
#
CREATE TABLE shadowlog (
  id int(11) DEFAULT '0' NOT NULL auto_increment,
  ts timestamp(14),
  reflected tinyint(4) DEFAULT '0' NOT NULL,
  command mediumtext NOT NULL,
  PRIMARY KEY (id)
);
create index index_38 on shadowlog (reflected);

#
# Table structure for table 'versions'
#
CREATE TABLE versions (
  value tinytext,
  program varchar(64) DEFAULT '' NOT NULL
);

#
# Table structure for table 'votes'
#
CREATE TABLE votes (
  who mediumint(9) DEFAULT '0' NOT NULL,
  bug_id mediumint(9) DEFAULT '0' NOT NULL,
  count smallint(6) DEFAULT '0' NOT NULL
);
create index index_5 on votes (who);
create index index_6 on votes (bug_id);

#
# Table structure for table 'watch'
#
CREATE TABLE watch (
  watcher mediumint(9) DEFAULT '0' NOT NULL,
  watched mediumint(9) DEFAULT '0' NOT NULL
);
create index index_36 on watch (watched);
create unique index index_37 on watch (watcher, watched);
