#SKD101|golfspbc_dbbgz|63|2017.01.24 11:50:36|726|7|5|5|1|7|232|55|2|48|15|5|5|5|7|5|2|4|6|4|6|56|11|12|22|15|169|10|5

CREATE TABLE `attach_data` (
  `id` mediumint(9) NOT NULL,
  `thedata` longblob NOT NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT `fk_attach_data_id_attachments_attach_id` FOREIGN KEY (`id`) REFERENCES `attachments` (`attach_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */ MAX_ROWS=100000 AVG_ROW_LENGTH=1000000;

CREATE TABLE `attachments` (
  `attach_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `bug_id` mediumint(9) NOT NULL,
  `creation_ts` datetime NOT NULL,
  `modification_time` datetime NOT NULL,
  `description` tinytext NOT NULL,
  `mimetype` tinytext NOT NULL,
  `ispatch` tinyint(4) NOT NULL DEFAULT '0',
  `filename` varchar(100) NOT NULL,
  `submitter_id` mediumint(9) NOT NULL,
  `isobsolete` tinyint(4) NOT NULL DEFAULT '0',
  `isprivate` tinyint(4) NOT NULL DEFAULT '0',
  `isurl` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`attach_id`),
  KEY `attachments_bug_id_idx` (`bug_id`),
  KEY `attachments_creation_ts_idx` (`creation_ts`),
  KEY `attachments_modification_time_idx` (`modification_time`),
  KEY `attachments_submitter_id_idx` (`submitter_id`,`bug_id`),
  CONSTRAINT `fk_attachments_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_attachments_submitter_id_profiles_userid` FOREIGN KEY (`submitter_id`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `bug_group_map` (
  `bug_id` mediumint(9) NOT NULL,
  `group_id` mediumint(9) NOT NULL,
  UNIQUE KEY `bug_group_map_bug_id_idx` (`bug_id`,`group_id`),
  KEY `bug_group_map_group_id_idx` (`group_id`),
  CONSTRAINT `fk_bug_group_map_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_bug_group_map_group_id_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `bug_see_also` (
  `bug_id` mediumint(9) NOT NULL,
  `value` varchar(255) NOT NULL,
  UNIQUE KEY `bug_see_also_bug_id_idx` (`bug_id`,`value`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `bug_severity` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `bug_severity_value_idx` (`value`),
  KEY `bug_severity_sortkey_idx` (`sortkey`,`value`),
  KEY `bug_severity_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `bug_severity` VALUES
(1, 'blocker', 100, 1, NULL),
(2, 'critical', 200, 1, NULL),
(3, 'major', 300, 1, NULL),
(4, 'normal', 400, 1, NULL),
(5, 'minor', 500, 1, NULL),
(6, 'trivial', 600, 1, NULL),
(7, 'enhancement', 700, 1, NULL);

CREATE TABLE `bug_status` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  `is_open` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `bug_status_value_idx` (`value`),
  KEY `bug_status_sortkey_idx` (`sortkey`,`value`),
  KEY `bug_status_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `bug_status` VALUES
(1, 'UNCONFIRMED', 100, 1, NULL, 1),
(2, 'CONFIRMED', 200, 1, NULL, 1),
(3, 'IN_PROGRESS', 300, 1, NULL, 1),
(4, 'RESOLVED', 400, 1, NULL, 0),
(5, 'VERIFIED', 500, 1, NULL, 0);

CREATE TABLE `bugs` (
  `bug_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `assigned_to` mediumint(9) NOT NULL,
  `bug_file_loc` mediumtext,
  `bug_severity` varchar(64) NOT NULL,
  `bug_status` varchar(64) NOT NULL,
  `creation_ts` datetime DEFAULT NULL,
  `delta_ts` datetime NOT NULL,
  `short_desc` varchar(255) NOT NULL,
  `op_sys` varchar(64) NOT NULL,
  `priority` varchar(64) NOT NULL,
  `product_id` smallint(6) NOT NULL,
  `rep_platform` varchar(64) NOT NULL,
  `reporter` mediumint(9) NOT NULL,
  `version` varchar(64) NOT NULL,
  `component_id` smallint(6) NOT NULL,
  `resolution` varchar(64) NOT NULL DEFAULT '',
  `target_milestone` varchar(20) NOT NULL DEFAULT '---',
  `qa_contact` mediumint(9) DEFAULT NULL,
  `status_whiteboard` mediumtext NOT NULL,
  `lastdiffed` datetime DEFAULT NULL,
  `everconfirmed` tinyint(4) NOT NULL,
  `reporter_accessible` tinyint(4) NOT NULL DEFAULT '1',
  `cclist_accessible` tinyint(4) NOT NULL DEFAULT '1',
  `estimated_time` decimal(7,2) NOT NULL DEFAULT '0.00',
  `remaining_time` decimal(7,2) NOT NULL DEFAULT '0.00',
  `deadline` datetime DEFAULT NULL,
  `alias` varchar(20) DEFAULT NULL,
  `cf_estdev` varchar(255) DEFAULT NULL,
  `cf_est` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`bug_id`),
  UNIQUE KEY `bugs_alias_idx` (`alias`),
  KEY `bugs_assigned_to_idx` (`assigned_to`),
  KEY `bugs_creation_ts_idx` (`creation_ts`),
  KEY `bugs_delta_ts_idx` (`delta_ts`),
  KEY `bugs_bug_severity_idx` (`bug_severity`),
  KEY `bugs_bug_status_idx` (`bug_status`),
  KEY `bugs_op_sys_idx` (`op_sys`),
  KEY `bugs_priority_idx` (`priority`),
  KEY `bugs_product_id_idx` (`product_id`),
  KEY `bugs_reporter_idx` (`reporter`),
  KEY `bugs_version_idx` (`version`),
  KEY `bugs_component_id_idx` (`component_id`),
  KEY `bugs_resolution_idx` (`resolution`),
  KEY `bugs_target_milestone_idx` (`target_milestone`),
  KEY `bugs_qa_contact_idx` (`qa_contact`),
  CONSTRAINT `fk_bugs_assigned_to_profiles_userid` FOREIGN KEY (`assigned_to`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_component_id_components_id` FOREIGN KEY (`component_id`) REFERENCES `components` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_reporter_profiles_userid` FOREIGN KEY (`reporter`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `bugs_activity` (
  `bug_id` mediumint(9) NOT NULL,
  `attach_id` mediumint(9) DEFAULT NULL,
  `who` mediumint(9) NOT NULL,
  `bug_when` datetime NOT NULL,
  `fieldid` mediumint(9) NOT NULL,
  `added` varchar(255) DEFAULT NULL,
  `removed` tinytext,
  `comment_id` mediumint(9) DEFAULT NULL,
  KEY `bugs_activity_bug_id_idx` (`bug_id`),
  KEY `bugs_activity_who_idx` (`who`),
  KEY `bugs_activity_bug_when_idx` (`bug_when`),
  KEY `bugs_activity_fieldid_idx` (`fieldid`),
  KEY `bugs_activity_added_idx` (`added`),
  KEY `fk_bugs_activity_comment_id_longdescs_comment_id` (`comment_id`),
  KEY `fk_bugs_activity_attach_id_attachments_attach_id` (`attach_id`),
  CONSTRAINT `fk_bugs_activity_attach_id_attachments_attach_id` FOREIGN KEY (`attach_id`) REFERENCES `attachments` (`attach_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_activity_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_activity_comment_id_longdescs_comment_id` FOREIGN KEY (`comment_id`) REFERENCES `longdescs` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_activity_fieldid_fielddefs_id` FOREIGN KEY (`fieldid`) REFERENCES `fielddefs` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_bugs_activity_who_profiles_userid` FOREIGN KEY (`who`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `bugs_activity` VALUES
(1, NULL, 2, '2011-01-10 00:09:39', 46, '1', '', NULL),
(1, NULL, 2, '2011-01-10 00:09:39', 39, '10', '0.00', NULL),
(1, NULL, 2, '2011-01-10 00:09:39', 40, '02', '0.00', NULL),
(1, NULL, 1, '2011-01-10 00:21:55', 46, '12', '', NULL),
(1, NULL, 1, '2011-01-10 00:21:55', 40, '0', '2.00', NULL);

CREATE TABLE `bugs_fulltext` (
  `bug_id` mediumint(9) NOT NULL,
  `short_desc` varchar(255) NOT NULL,
  `comments` mediumtext,
  `comments_noprivate` mediumtext,
  PRIMARY KEY (`bug_id`),
  FULLTEXT KEY `bugs_fulltext_short_desc_idx` (`short_desc`),
  FULLTEXT KEY `bugs_fulltext_comments_idx` (`comments`),
  FULLTEXT KEY `bugs_fulltext_comments_noprivate_idx` (`comments_noprivate`)
) ENGINE=MyISAM /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `bugs_fulltext` VALUES
(1, 'bug1', 'some description of the bug1.\nJust a plain text.\n\nчтото тут исправил я (y1@avantlab.com)\n\n(In reply to comment #0)\n> some description of the bug1.\n> Just a plain text.\n\nпросто описание под Description (\"reply\")', 'some description of the bug1.\nJust a plain text.\n\nчтото тут исправил я (y1@avantlab.com)\n\n(In reply to comment #0)\n> some description of the bug1.\n> Just a plain text.\n\nпросто описание под Description (\"reply\")');

CREATE TABLE `bz_schema` (
  `schema_data` longblob NOT NULL,
  `version` decimal(3,2) NOT NULL
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `category_group_map` (
  `category_id` smallint(6) NOT NULL,
  `group_id` mediumint(9) NOT NULL,
  UNIQUE KEY `category_group_map_category_id_idx` (`category_id`,`group_id`),
  KEY `fk_category_group_map_group_id_groups_id` (`group_id`),
  CONSTRAINT `fk_category_group_map_category_id_series_categories_id` FOREIGN KEY (`category_id`) REFERENCES `series_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_category_group_map_group_id_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `cc` (
  `bug_id` mediumint(9) NOT NULL,
  `who` mediumint(9) NOT NULL,
  UNIQUE KEY `cc_bug_id_idx` (`bug_id`,`who`),
  KEY `cc_who_idx` (`who`),
  CONSTRAINT `fk_cc_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_cc_who_profiles_userid` FOREIGN KEY (`who`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `classifications` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `description` mediumtext,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `classifications_name_idx` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `component_cc` (
  `user_id` mediumint(9) NOT NULL,
  `component_id` smallint(6) NOT NULL,
  UNIQUE KEY `component_cc_user_id_idx` (`component_id`,`user_id`),
  KEY `fk_component_cc_user_id_profiles_userid` (`user_id`),
  CONSTRAINT `fk_component_cc_component_id_components_id` FOREIGN KEY (`component_id`) REFERENCES `components` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_component_cc_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `components` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `product_id` smallint(6) NOT NULL,
  `initialowner` mediumint(9) NOT NULL,
  `initialqacontact` mediumint(9) DEFAULT NULL,
  `description` mediumtext NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `components_product_id_idx` (`product_id`,`name`),
  KEY `components_name_idx` (`name`),
  KEY `fk_components_initialowner_profiles_userid` (`initialowner`),
  KEY `fk_components_initialqacontact_profiles_userid` (`initialqacontact`),
  CONSTRAINT `fk_components_initialowner_profiles_userid` FOREIGN KEY (`initialowner`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
  CONSTRAINT `fk_components_initialqacontact_profiles_userid` FOREIGN KEY (`initialqacontact`) REFERENCES `profiles` (`userid`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `fk_components_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `components` VALUES
(1, 'TestComponent', 1, 1, NULL, 'This is a test component in the test product database. This ought to be blown away and replaced with real stuff in a finished installation of Bugzilla.'),
(2, 'ultraMobile', 2, 1, NULL, 'ultraMobile'),
(3, 'ultraComm', 2, 2, NULL, 'ultraComm'),
(4, 'WinForce', 3, 1, NULL, 'WinForce'),
(5, 'sinema', 3, 1, NULL, 'sinema'),
(6, 'Sugar', 4, 1, NULL, 'Sugar'),
(7, 'comp1', 5, 2, NULL, 'comp1');

CREATE TABLE `dependencies` (
  `blocked` mediumint(9) NOT NULL,
  `dependson` mediumint(9) NOT NULL,
  KEY `dependencies_blocked_idx` (`blocked`),
  KEY `dependencies_dependson_idx` (`dependson`),
  CONSTRAINT `fk_dependencies_blocked_bugs_bug_id` FOREIGN KEY (`blocked`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_dependencies_dependson_bugs_bug_id` FOREIGN KEY (`dependson`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `duplicates` (
  `dupe_of` mediumint(9) NOT NULL,
  `dupe` mediumint(9) NOT NULL,
  PRIMARY KEY (`dupe`),
  KEY `fk_duplicates_dupe_of_bugs_bug_id` (`dupe_of`),
  CONSTRAINT `fk_duplicates_dupe_bugs_bug_id` FOREIGN KEY (`dupe`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_duplicates_dupe_of_bugs_bug_id` FOREIGN KEY (`dupe_of`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `email_setting` (
  `user_id` mediumint(9) NOT NULL,
  `relationship` tinyint(4) NOT NULL,
  `event` tinyint(4) NOT NULL,
  UNIQUE KEY `email_setting_user_id_idx` (`user_id`,`relationship`,`event`),
  CONSTRAINT `fk_email_setting_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `email_setting` VALUES
(1, 0, 0),
(1, 0, 1),
(1, 0, 2),
(1, 0, 3),
(1, 0, 4),
(1, 0, 5),
(1, 0, 6),
(1, 0, 7),
(1, 0, 9),
(1, 0, 10),
(1, 0, 50),
(1, 1, 0),
(1, 1, 1),
(1, 1, 2),
(1, 1, 3),
(1, 1, 4),
(1, 1, 5),
(1, 1, 6),
(1, 1, 7),
(1, 1, 9),
(1, 1, 10),
(1, 1, 50),
(1, 2, 0),
(1, 2, 1),
(1, 2, 2),
(1, 2, 3),
(1, 2, 4),
(1, 2, 5),
(1, 2, 6),
(1, 2, 7),
(1, 2, 8),
(1, 2, 9),
(1, 2, 10),
(1, 2, 50),
(1, 3, 0),
(1, 3, 1),
(1, 3, 2),
(1, 3, 3),
(1, 3, 4),
(1, 3, 5),
(1, 3, 6),
(1, 3, 7),
(1, 3, 9),
(1, 3, 10),
(1, 3, 50),
(1, 5, 0),
(1, 5, 1),
(1, 5, 2),
(1, 5, 3),
(1, 5, 4),
(1, 5, 5),
(1, 5, 6),
(1, 5, 7),
(1, 5, 9),
(1, 5, 10),
(1, 5, 50),
(1, 100, 100),
(1, 100, 101),
(2, 0, 0),
(2, 0, 1),
(2, 0, 2),
(2, 0, 3),
(2, 0, 4),
(2, 0, 5),
(2, 0, 6),
(2, 0, 7),
(2, 0, 9),
(2, 0, 10),
(2, 0, 50),
(2, 1, 0),
(2, 1, 1),
(2, 1, 2),
(2, 1, 3),
(2, 1, 4),
(2, 1, 5),
(2, 1, 6),
(2, 1, 7),
(2, 1, 9),
(2, 1, 10),
(2, 1, 50),
(2, 2, 0),
(2, 2, 1),
(2, 2, 2),
(2, 2, 3),
(2, 2, 4),
(2, 2, 5),
(2, 2, 6),
(2, 2, 7),
(2, 2, 8),
(2, 2, 9),
(2, 2, 10),
(2, 2, 50),
(2, 3, 0),
(2, 3, 1),
(2, 3, 2),
(2, 3, 3),
(2, 3, 4),
(2, 3, 5),
(2, 3, 6),
(2, 3, 7),
(2, 3, 9),
(2, 3, 10),
(2, 3, 50),
(2, 5, 0),
(2, 5, 1),
(2, 5, 2),
(2, 5, 3),
(2, 5, 4),
(2, 5, 5),
(2, 5, 6),
(2, 5, 7),
(2, 5, 9),
(2, 5, 10),
(2, 5, 50),
(2, 100, 100),
(2, 100, 101),
(3, 0, 0),
(3, 0, 1),
(3, 0, 2),
(3, 0, 3),
(3, 0, 4),
(3, 0, 5),
(3, 0, 6),
(3, 0, 7),
(3, 0, 9),
(3, 0, 10),
(3, 0, 50),
(3, 1, 0),
(3, 1, 1),
(3, 1, 2),
(3, 1, 3),
(3, 1, 4),
(3, 1, 5),
(3, 1, 6),
(3, 1, 7),
(3, 1, 9),
(3, 1, 10),
(3, 1, 50),
(3, 2, 0),
(3, 2, 1),
(3, 2, 2),
(3, 2, 3),
(3, 2, 4),
(3, 2, 5),
(3, 2, 6),
(3, 2, 7),
(3, 2, 8),
(3, 2, 9),
(3, 2, 10),
(3, 2, 50),
(3, 3, 0),
(3, 3, 1),
(3, 3, 2),
(3, 3, 3),
(3, 3, 4),
(3, 3, 5),
(3, 3, 6),
(3, 3, 7),
(3, 3, 9),
(3, 3, 10),
(3, 3, 50),
(3, 5, 0),
(3, 5, 1),
(3, 5, 2),
(3, 5, 3),
(3, 5, 4),
(3, 5, 5),
(3, 5, 6),
(3, 5, 7),
(3, 5, 9),
(3, 5, 10),
(3, 5, 50),
(3, 100, 100),
(3, 100, 101),
(4, 0, 0),
(4, 0, 1),
(4, 0, 2),
(4, 0, 3),
(4, 0, 4),
(4, 0, 5),
(4, 0, 6),
(4, 0, 7),
(4, 0, 9),
(4, 0, 10),
(4, 0, 50),
(4, 1, 0),
(4, 1, 1),
(4, 1, 2),
(4, 1, 3),
(4, 1, 4),
(4, 1, 5),
(4, 1, 6),
(4, 1, 7),
(4, 1, 9),
(4, 1, 10),
(4, 1, 50),
(4, 2, 0),
(4, 2, 1),
(4, 2, 2),
(4, 2, 3),
(4, 2, 4),
(4, 2, 5),
(4, 2, 6),
(4, 2, 7),
(4, 2, 8),
(4, 2, 9),
(4, 2, 10),
(4, 2, 50),
(4, 3, 0),
(4, 3, 1),
(4, 3, 2),
(4, 3, 3),
(4, 3, 4),
(4, 3, 5),
(4, 3, 6),
(4, 3, 7),
(4, 3, 9),
(4, 3, 10),
(4, 3, 50),
(4, 5, 0),
(4, 5, 1),
(4, 5, 2),
(4, 5, 3),
(4, 5, 4),
(4, 5, 5),
(4, 5, 6),
(4, 5, 7),
(4, 5, 9),
(4, 5, 10),
(4, 5, 50),
(4, 100, 100),
(4, 100, 101);

CREATE TABLE `fielddefs` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `type` smallint(6) NOT NULL DEFAULT '0',
  `custom` tinyint(4) NOT NULL DEFAULT '0',
  `description` tinytext NOT NULL,
  `mailhead` tinyint(4) NOT NULL DEFAULT '0',
  `sortkey` smallint(6) NOT NULL,
  `obsolete` tinyint(4) NOT NULL DEFAULT '0',
  `enter_bug` tinyint(4) NOT NULL DEFAULT '0',
  `buglist` tinyint(4) NOT NULL DEFAULT '0',
  `visibility_field_id` mediumint(9) DEFAULT NULL,
  `visibility_value_id` smallint(6) DEFAULT NULL,
  `value_field_id` mediumint(9) DEFAULT NULL,
  `reverse_desc` tinytext,
  `is_mandatory` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `fielddefs_name_idx` (`name`),
  KEY `fielddefs_sortkey_idx` (`sortkey`),
  KEY `fielddefs_value_field_id_idx` (`value_field_id`),
  KEY `fielddefs_is_mandatory_idx` (`is_mandatory`),
  KEY `fk_fielddefs_visibility_field_id_fielddefs_id` (`visibility_field_id`),
  CONSTRAINT `fk_fielddefs_value_field_id_fielddefs_id` FOREIGN KEY (`value_field_id`) REFERENCES `fielddefs` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_fielddefs_visibility_field_id_fielddefs_id` FOREIGN KEY (`visibility_field_id`) REFERENCES `fielddefs` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=56 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `fielddefs` VALUES
(1, 'bug_id', 0, 0, 'Bug #', 1, 100, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(2, 'short_desc', 0, 0, 'Summary', 1, 200, 0, 0, 1, NULL, NULL, NULL, NULL, 1),
(3, 'classification', 2, 0, 'Classification', 1, 300, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(4, 'product', 2, 0, 'Product', 1, 400, 0, 0, 1, NULL, NULL, NULL, NULL, 1),
(5, 'version', 0, 0, 'Version', 1, 500, 0, 0, 1, NULL, NULL, NULL, NULL, 1),
(6, 'rep_platform', 2, 0, 'Platform', 1, 600, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(7, 'bug_file_loc', 0, 0, 'URL', 1, 700, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(8, 'op_sys', 2, 0, 'OS/Version', 1, 800, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(9, 'bug_status', 2, 0, 'Status', 1, 900, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(10, 'status_whiteboard', 0, 0, 'Status Whiteboard', 1, 1000, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(11, 'keywords', 8, 0, 'Keywords', 1, 1100, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(12, 'resolution', 2, 0, 'Resolution', 0, 1200, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(13, 'bug_severity', 2, 0, 'Severity', 1, 1300, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(14, 'priority', 2, 0, 'Priority', 1, 1400, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(15, 'component', 2, 0, 'Component', 1, 1500, 0, 0, 1, NULL, NULL, NULL, NULL, 1),
(16, 'assigned_to', 0, 0, 'AssignedTo', 1, 1600, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(17, 'reporter', 0, 0, 'ReportedBy', 1, 1700, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(18, 'qa_contact', 0, 0, 'QAContact', 1, 1800, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(19, 'cc', 0, 0, 'CC', 1, 1900, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(20, 'dependson', 0, 0, 'Depends on', 1, 2000, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(21, 'blocked', 0, 0, 'Blocks', 1, 2100, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(22, 'attachments.description', 0, 0, 'Attachment description', 0, 2200, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(23, 'attachments.filename', 0, 0, 'Attachment filename', 0, 2300, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(24, 'attachments.mimetype', 0, 0, 'Attachment mime type', 0, 2400, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(25, 'attachments.ispatch', 0, 0, 'Attachment is patch', 0, 2500, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(26, 'attachments.isobsolete', 0, 0, 'Attachment is obsolete', 0, 2600, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(27, 'attachments.isprivate', 0, 0, 'Attachment is private', 0, 2700, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(28, 'attachments.submitter', 0, 0, 'Attachment creator', 0, 2800, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(29, 'target_milestone', 0, 0, 'Target Milestone', 0, 2900, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(30, 'creation_ts', 0, 0, 'Creation date', 0, 3000, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(31, 'delta_ts', 0, 0, 'Last changed date', 0, 3100, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(32, 'longdesc', 0, 0, 'Comment', 0, 3200, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(33, 'longdescs.isprivate', 0, 0, 'Comment is private', 0, 3300, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(34, 'alias', 0, 0, 'Alias', 0, 3400, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(35, 'everconfirmed', 0, 0, 'Ever Confirmed', 0, 3500, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(36, 'reporter_accessible', 0, 0, 'Reporter Accessible', 0, 3600, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(37, 'cclist_accessible', 0, 0, 'CC Accessible', 0, 3700, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(38, 'bug_group', 0, 0, 'Group', 1, 3800, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(39, 'estimated_time', 0, 0, 'Estimated Hours', 1, 3900, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(40, 'remaining_time', 0, 0, 'Remaining Hours', 0, 4000, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(41, 'deadline', 5, 0, 'Deadline', 1, 4100, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(42, 'commenter', 0, 0, 'Commenter', 0, 4200, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(43, 'flagtypes.name', 0, 0, 'Flags', 0, 4300, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(44, 'requestees.login_name', 0, 0, 'Flag Requestee', 0, 4400, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(45, 'setters.login_name', 0, 0, 'Flag Setter', 0, 4500, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(46, 'work_time', 0, 0, 'Hours Worked', 0, 4600, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(47, 'percentage_complete', 0, 0, 'Percentage Complete', 0, 4700, 0, 0, 1, NULL, NULL, NULL, NULL, 0),
(48, 'content', 0, 0, 'Content', 0, 4800, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(49, 'attach_data.thedata', 0, 0, 'Attachment data', 0, 4900, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(50, 'attachments.isurl', 0, 0, 'Attachment is a URL', 0, 5000, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(51, 'owner_idle_time', 0, 0, 'Time Since Assignee Touched', 0, 5100, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(52, 'see_also', 7, 0, 'See Also', 0, 5200, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(53, 'days_elapsed', 0, 0, 'Days since bug changed', 0, 5300, 0, 0, 0, NULL, NULL, NULL, NULL, 0),
(54, 'cf_estdev', 1, 1, 'EstDev', 0, 400, 0, 1, 1, NULL, NULL, NULL, NULL, 0),
(55, 'cf_est', 1, 1, 'Estim', 0, 500, 0, 1, 1, NULL, NULL, NULL, NULL, 0);

CREATE TABLE `flagexclusions` (
  `type_id` smallint(6) NOT NULL,
  `product_id` smallint(6) DEFAULT NULL,
  `component_id` smallint(6) DEFAULT NULL,
  KEY `flagexclusions_type_id_idx` (`type_id`,`product_id`,`component_id`),
  KEY `fk_flagexclusions_product_id_products_id` (`product_id`),
  KEY `fk_flagexclusions_component_id_components_id` (`component_id`),
  CONSTRAINT `fk_flagexclusions_component_id_components_id` FOREIGN KEY (`component_id`) REFERENCES `components` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flagexclusions_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flagexclusions_type_id_flagtypes_id` FOREIGN KEY (`type_id`) REFERENCES `flagtypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `flaginclusions` (
  `type_id` smallint(6) NOT NULL,
  `product_id` smallint(6) DEFAULT NULL,
  `component_id` smallint(6) DEFAULT NULL,
  KEY `flaginclusions_type_id_idx` (`type_id`,`product_id`,`component_id`),
  KEY `fk_flaginclusions_product_id_products_id` (`product_id`),
  KEY `fk_flaginclusions_component_id_components_id` (`component_id`),
  CONSTRAINT `fk_flaginclusions_component_id_components_id` FOREIGN KEY (`component_id`) REFERENCES `components` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flaginclusions_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flaginclusions_type_id_flagtypes_id` FOREIGN KEY (`type_id`) REFERENCES `flagtypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `flags` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `type_id` smallint(6) NOT NULL,
  `status` char(1) NOT NULL,
  `bug_id` mediumint(9) NOT NULL,
  `attach_id` mediumint(9) DEFAULT NULL,
  `creation_date` datetime NOT NULL,
  `modification_date` datetime DEFAULT NULL,
  `setter_id` mediumint(9) NOT NULL,
  `requestee_id` mediumint(9) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `flags_bug_id_idx` (`bug_id`,`attach_id`),
  KEY `flags_setter_id_idx` (`setter_id`),
  KEY `flags_requestee_id_idx` (`requestee_id`),
  KEY `flags_type_id_idx` (`type_id`),
  KEY `fk_flags_attach_id_attachments_attach_id` (`attach_id`),
  CONSTRAINT `fk_flags_attach_id_attachments_attach_id` FOREIGN KEY (`attach_id`) REFERENCES `attachments` (`attach_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flags_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flags_requestee_id_profiles_userid` FOREIGN KEY (`requestee_id`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
  CONSTRAINT `fk_flags_setter_id_profiles_userid` FOREIGN KEY (`setter_id`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE,
  CONSTRAINT `fk_flags_type_id_flagtypes_id` FOREIGN KEY (`type_id`) REFERENCES `flagtypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `flagtypes` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `description` mediumtext NOT NULL,
  `cc_list` varchar(200) DEFAULT NULL,
  `target_type` char(1) NOT NULL DEFAULT 'b',
  `is_active` tinyint(4) NOT NULL DEFAULT '1',
  `is_requestable` tinyint(4) NOT NULL DEFAULT '0',
  `is_requesteeble` tinyint(4) NOT NULL DEFAULT '0',
  `is_multiplicable` tinyint(4) NOT NULL DEFAULT '0',
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `grant_group_id` mediumint(9) DEFAULT NULL,
  `request_group_id` mediumint(9) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_flagtypes_grant_group_id_groups_id` (`grant_group_id`),
  KEY `fk_flagtypes_request_group_id_groups_id` (`request_group_id`),
  CONSTRAINT `fk_flagtypes_grant_group_id_groups_id` FOREIGN KEY (`grant_group_id`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `fk_flagtypes_request_group_id_groups_id` FOREIGN KEY (`request_group_id`) REFERENCES `groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `group_control_map` (
  `group_id` mediumint(9) NOT NULL,
  `product_id` smallint(6) NOT NULL,
  `entry` tinyint(4) NOT NULL DEFAULT '0',
  `membercontrol` tinyint(4) NOT NULL DEFAULT '0',
  `othercontrol` tinyint(4) NOT NULL DEFAULT '0',
  `canedit` tinyint(4) NOT NULL DEFAULT '0',
  `editcomponents` tinyint(4) NOT NULL DEFAULT '0',
  `editbugs` tinyint(4) NOT NULL DEFAULT '0',
  `canconfirm` tinyint(4) NOT NULL DEFAULT '0',
  UNIQUE KEY `group_control_map_product_id_idx` (`product_id`,`group_id`),
  KEY `group_control_map_group_id_idx` (`group_id`),
  CONSTRAINT `fk_group_control_map_group_id_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_group_control_map_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `group_control_map` VALUES
(14, 2, 1, 3, 3, 0, 0, 0, 0),
(15, 5, 1, 2, 0, 1, 1, 1, 1);

CREATE TABLE `group_group_map` (
  `member_id` mediumint(9) NOT NULL,
  `grantor_id` mediumint(9) NOT NULL,
  `grant_type` tinyint(4) NOT NULL DEFAULT '0',
  UNIQUE KEY `group_group_map_member_id_idx` (`member_id`,`grantor_id`,`grant_type`),
  KEY `fk_group_group_map_grantor_id_groups_id` (`grantor_id`),
  CONSTRAINT `fk_group_group_map_grantor_id_groups_id` FOREIGN KEY (`grantor_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_group_group_map_member_id_groups_id` FOREIGN KEY (`member_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `group_group_map` VALUES
(1, 1, 0),
(1, 1, 1),
(1, 1, 2),
(1, 2, 0),
(1, 2, 1),
(1, 2, 2),
(1, 3, 0),
(1, 3, 1),
(1, 3, 2),
(1, 4, 0),
(1, 4, 1),
(1, 4, 2),
(1, 5, 0),
(1, 5, 1),
(1, 5, 2),
(1, 6, 0),
(1, 6, 1),
(1, 6, 2),
(1, 7, 0),
(1, 7, 1),
(1, 7, 2),
(1, 8, 0),
(1, 8, 1),
(1, 8, 2),
(1, 9, 0),
(1, 9, 1),
(1, 9, 2),
(1, 10, 0),
(1, 10, 1),
(1, 10, 2),
(1, 11, 0),
(1, 11, 1),
(1, 11, 2),
(8, 11, 0),
(10, 11, 0),
(1, 12, 0),
(1, 12, 1),
(1, 12, 2),
(1, 13, 0),
(1, 13, 1),
(1, 13, 2),
(12, 13, 0),
(1, 14, 1),
(1, 14, 2),
(8, 14, 0),
(1, 15, 0),
(1, 15, 1),
(1, 15, 2);

CREATE TABLE `groups` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` mediumtext NOT NULL,
  `isbuggroup` tinyint(4) NOT NULL,
  `userregexp` tinytext NOT NULL,
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `icon_url` tinytext,
  PRIMARY KEY (`id`),
  UNIQUE KEY `groups_name_idx` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=16 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `groups` VALUES
(1, 'admin', 'Administrators', 0, '', 1, NULL),
(2, 'tweakparams', 'Can change Parameters', 0, '', 1, NULL),
(3, 'editusers', 'Can edit or disable users', 0, '', 1, NULL),
(4, 'creategroups', 'Can create and destroy groups', 0, '', 1, NULL),
(5, 'editclassifications', 'Can create, destroy, and edit classifications', 0, '', 1, NULL),
(6, 'editcomponents', 'Can create, destroy, and edit components', 0, '', 1, NULL),
(7, 'editkeywords', 'Can create, destroy, and edit keywords', 0, '', 1, NULL),
(8, 'editbugs', 'Can edit all bug fields', 0, '.*', 1, NULL),
(9, 'canconfirm', 'Can confirm a bug or mark it a duplicate', 0, '', 1, NULL),
(10, 'bz_canusewhineatothers', 'Can configure whine reports for other users', 0, '', 1, NULL),
(11, 'bz_canusewhines', 'User can configure whine reports for self', 0, '', 1, NULL),
(12, 'bz_sudoers', 'Can perform actions as other users', 0, '', 1, NULL),
(13, 'bz_sudo_protect', 'Can not be impersonated by other users', 0, '', 1, NULL),
(14, 'DevWebGroup', 'DevWebGroup', 1, '', 1, NULL),
(15, 'Proj2', 'Access to bugs in the Proj2 product', 1, '', 1, NULL);

CREATE TABLE `keyworddefs` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `description` mediumtext NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `keyworddefs_name_idx` (`name`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `keywords` (
  `bug_id` mediumint(9) NOT NULL,
  `keywordid` smallint(6) NOT NULL,
  UNIQUE KEY `keywords_bug_id_idx` (`bug_id`,`keywordid`),
  KEY `keywords_keywordid_idx` (`keywordid`),
  CONSTRAINT `fk_keywords_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_keywords_keywordid_keyworddefs_id` FOREIGN KEY (`keywordid`) REFERENCES `keyworddefs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `login_failure` (
  `user_id` mediumint(9) NOT NULL,
  `login_time` datetime NOT NULL,
  `ip_addr` varchar(40) NOT NULL,
  KEY `login_failure_user_id_idx` (`user_id`),
  CONSTRAINT `fk_login_failure_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `longdescs` (
  `comment_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `bug_id` mediumint(9) NOT NULL,
  `who` mediumint(9) NOT NULL,
  `bug_when` datetime NOT NULL,
  `work_time` decimal(7,2) NOT NULL DEFAULT '0.00',
  `thetext` mediumtext NOT NULL,
  `isprivate` tinyint(4) NOT NULL DEFAULT '0',
  `already_wrapped` tinyint(4) NOT NULL DEFAULT '0',
  `type` smallint(6) NOT NULL DEFAULT '0',
  `extra_data` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`comment_id`),
  KEY `longdescs_bug_id_idx` (`bug_id`),
  KEY `longdescs_who_idx` (`who`,`bug_id`),
  KEY `longdescs_bug_when_idx` (`bug_when`),
  CONSTRAINT `fk_longdescs_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_longdescs_who_profiles_userid` FOREIGN KEY (`who`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `longdescs` VALUES
(1, 1, 1, '2011-01-10 00:03:08', '0.00', 'some description of the bug1.\nJust a plain text.', 0, 0, 0, NULL),
(2, 1, 2, '2011-01-10 00:09:39', '1.00', '', 0, 0, 0, NULL),
(3, 1, 2, '2011-01-10 00:14:17', '0.00', 'чтото тут исправил я (y1@avantlab.com)', 0, 0, 0, NULL),
(4, 1, 1, '2011-01-10 00:21:55', '12.00', '', 0, 0, 0, NULL),
(5, 1, 1, '2011-01-10 00:25:32', '0.00', '(In reply to comment #0)\n> some description of the bug1.\n> Just a plain text.\n\nпросто описание под Description (\"reply\")', 0, 0, 0, NULL);

CREATE TABLE `milestones` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `product_id` smallint(6) NOT NULL,
  `value` varchar(20) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `milestones_product_id_idx` (`product_id`,`value`),
  CONSTRAINT `fk_milestones_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `milestones` VALUES
(1, 1, '---', 0),
(2, 2, '---', 0),
(3, 3, '---', 0),
(4, 4, '---', 0),
(5, 5, '---', 0);

CREATE TABLE `namedqueries` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `userid` mediumint(9) NOT NULL,
  `name` varchar(64) NOT NULL,
  `query` mediumtext NOT NULL,
  `query_type` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `namedqueries_userid_idx` (`userid`,`name`),
  CONSTRAINT `fk_namedqueries_userid_profiles_userid` FOREIGN KEY (`userid`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `namedqueries_link_in_footer` (
  `namedquery_id` mediumint(9) NOT NULL,
  `user_id` mediumint(9) NOT NULL,
  UNIQUE KEY `namedqueries_link_in_footer_id_idx` (`namedquery_id`,`user_id`),
  KEY `namedqueries_link_in_footer_userid_idx` (`user_id`),
  CONSTRAINT `fk_namedqueries_link_in_footer_namedquery_id_namedqueries_id` FOREIGN KEY (`namedquery_id`) REFERENCES `namedqueries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_namedqueries_link_in_footer_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `namedquery_group_map` (
  `namedquery_id` mediumint(9) NOT NULL,
  `group_id` mediumint(9) NOT NULL,
  UNIQUE KEY `namedquery_group_map_namedquery_id_idx` (`namedquery_id`),
  KEY `namedquery_group_map_group_id_idx` (`group_id`),
  CONSTRAINT `fk_namedquery_group_map_group_id_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_namedquery_group_map_namedquery_id_namedqueries_id` FOREIGN KEY (`namedquery_id`) REFERENCES `namedqueries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `op_sys` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `op_sys_value_idx` (`value`),
  KEY `op_sys_sortkey_idx` (`sortkey`,`value`),
  KEY `op_sys_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `op_sys` VALUES
(1, 'All', 100, 1, NULL),
(2, 'Windows', 200, 1, NULL),
(3, 'Mac OS', 300, 1, NULL),
(4, 'Linux', 400, 1, NULL),
(5, 'Other', 500, 1, NULL);

CREATE TABLE `priority` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `priority_value_idx` (`value`),
  KEY `priority_sortkey_idx` (`sortkey`,`value`),
  KEY `priority_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `priority` VALUES
(1, 'Urgent', 150, 1, NULL),
(2, 'High', 200, 1, NULL),
(3, 'Normal', 300, 1, NULL),
(4, 'Low', 400, 1, NULL),
(5, 'Lowest', 500, 1, NULL),
(6, '---', 600, 1, NULL),
(7, 'Immidiate', 100, 1, NULL);

CREATE TABLE `products` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  `classification_id` smallint(6) NOT NULL DEFAULT '1',
  `description` mediumtext NOT NULL,
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `defaultmilestone` varchar(20) NOT NULL DEFAULT '---',
  `allows_unconfirmed` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_name_idx` (`name`),
  KEY `fk_products_classification_id_classifications_id` (`classification_id`),
  CONSTRAINT `fk_products_classification_id_classifications_id` FOREIGN KEY (`classification_id`) REFERENCES `classifications` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `products` VALUES
(1, 'TestProduct', 1, 'This is a test product. This ought to be blown away and replaced with real stuff in a finished installation of bugzilla.', 1, '---', 1),
(2, 'Riccardo', 1, 'test bugzilla', 1, '---', 1),
(3, 'Yves', 1, 'Yves', 1, '---', 1),
(4, 'Sugar', 1, 'Sugar', 1, '---', 1),
(5, 'Proj2', 1, 'Proj2', 1, '---', 1);

CREATE TABLE `profile_search` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` mediumint(9) NOT NULL,
  `bug_list` mediumtext NOT NULL,
  `list_order` mediumtext,
  PRIMARY KEY (`id`),
  KEY `profile_search_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `profile_search` VALUES
(1, 2, '1', 'bug_status,priority,assigned_to,bug_id'),
(2, 1, '1', 'priority,bug_severity');

CREATE TABLE `profile_setting` (
  `user_id` mediumint(9) NOT NULL,
  `setting_name` varchar(32) NOT NULL,
  `setting_value` varchar(32) NOT NULL,
  UNIQUE KEY `profile_setting_value_unique_idx` (`user_id`,`setting_name`),
  KEY `fk_profile_setting_setting_name_setting_name` (`setting_name`),
  CONSTRAINT `fk_profile_setting_setting_name_setting_name` FOREIGN KEY (`setting_name`) REFERENCES `setting` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_profile_setting_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `profiles_activity` (
  `userid` mediumint(9) NOT NULL,
  `who` mediumint(9) NOT NULL,
  `profiles_when` datetime NOT NULL,
  `fieldid` mediumint(9) NOT NULL,
  `oldvalue` tinytext,
  `newvalue` tinytext,
  KEY `profiles_activity_userid_idx` (`userid`),
  KEY `profiles_activity_profiles_when_idx` (`profiles_when`),
  KEY `profiles_activity_fieldid_idx` (`fieldid`),
  KEY `fk_profiles_activity_who_profiles_userid` (`who`),
  CONSTRAINT `fk_profiles_activity_fieldid_fielddefs_id` FOREIGN KEY (`fieldid`) REFERENCES `fielddefs` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_profiles_activity_userid_profiles_userid` FOREIGN KEY (`userid`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_profiles_activity_who_profiles_userid` FOREIGN KEY (`who`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `profiles_activity` VALUES
(1, 1, '2011-01-08 02:29:03', 30, NULL, '2011-01-08 02:29:03'),
(2, 1, '2011-01-08 22:18:11', 30, NULL, '2011-01-08 22:18:11'),
(3, 1, '2011-01-08 22:22:11', 30, NULL, '2011-01-08 22:22:11'),
(2, 1, '2011-01-08 23:00:05', 38, '', 'editbugs, DevWebGroup'),
(2, 1, '2011-01-09 23:53:28', 38, '', 'Proj2'),
(4, 1, '2011-01-09 23:59:53', 30, NULL, '2011-01-09 23:59:53');

CREATE TABLE `quips` (
  `quipid` mediumint(9) NOT NULL AUTO_INCREMENT,
  `userid` mediumint(9) DEFAULT NULL,
  `quip` mediumtext NOT NULL,
  `approved` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`quipid`),
  KEY `fk_quips_userid_profiles_userid` (`userid`),
  CONSTRAINT `fk_quips_userid_profiles_userid` FOREIGN KEY (`userid`) REFERENCES `profiles` (`userid`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `rep_platform` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `rep_platform_value_idx` (`value`),
  KEY `rep_platform_sortkey_idx` (`sortkey`,`value`),
  KEY `rep_platform_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `rep_platform` VALUES
(1, 'All', 100, 1, NULL),
(2, 'PC', 200, 1, NULL),
(3, 'Macintosh', 300, 1, NULL),
(4, 'Other', 400, 1, NULL);

CREATE TABLE `resolution` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `isactive` tinyint(4) NOT NULL DEFAULT '1',
  `visibility_value_id` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `resolution_value_idx` (`value`),
  KEY `resolution_sortkey_idx` (`sortkey`,`value`),
  KEY `resolution_visibility_value_id_idx` (`visibility_value_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `resolution` VALUES
(1, '', 100, 1, NULL),
(2, 'FIXED', 200, 1, NULL),
(3, 'INVALID', 300, 1, NULL),
(4, 'WONTFIX', 400, 1, NULL),
(5, 'DUPLICATE', 500, 1, NULL),
(6, 'WORKSFORME', 600, 1, NULL);

CREATE TABLE `series` (
  `series_id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `creator` mediumint(9) DEFAULT NULL,
  `category` smallint(6) NOT NULL,
  `subcategory` smallint(6) NOT NULL,
  `name` varchar(64) NOT NULL,
  `frequency` smallint(6) NOT NULL,
  `query` mediumtext NOT NULL,
  `is_public` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`series_id`),
  UNIQUE KEY `series_creator_idx` (`creator`,`category`,`subcategory`,`name`),
  KEY `fk_series_subcategory_series_categories_id` (`subcategory`),
  KEY `fk_series_category_series_categories_id` (`category`),
  CONSTRAINT `fk_series_category_series_categories_id` FOREIGN KEY (`category`) REFERENCES `series_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_series_creator_profiles_userid` FOREIGN KEY (`creator`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_series_subcategory_series_categories_id` FOREIGN KEY (`subcategory`) REFERENCES `series_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=57 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `series` VALUES
(1, 1, 1, 2, 'UNCONFIRMED', 1, 'bug_status=UNCONFIRMED&product=Riccardo-ultraMobile', 1),
(2, 1, 1, 2, 'CONFIRMED', 1, 'bug_status=CONFIRMED&product=Riccardo-ultraMobile', 1),
(3, 1, 1, 2, 'IN_PROGRESS', 1, 'bug_status=IN_PROGRESS&product=Riccardo-ultraMobile', 1),
(4, 1, 1, 2, 'RESOLVED', 1, 'bug_status=RESOLVED&product=Riccardo-ultraMobile', 1),
(5, 1, 1, 2, 'VERIFIED', 1, 'bug_status=VERIFIED&product=Riccardo-ultraMobile', 1),
(6, 1, 1, 2, 'FIXED', 1, 'resolution=FIXED&product=Riccardo-ultraMobile', 1),
(7, 1, 1, 2, 'INVALID', 1, 'resolution=INVALID&product=Riccardo-ultraMobile', 1),
(8, 1, 1, 2, 'WONTFIX', 1, 'resolution=WONTFIX&product=Riccardo-ultraMobile', 1),
(9, 1, 1, 2, 'DUPLICATE', 1, 'resolution=DUPLICATE&product=Riccardo-ultraMobile', 1),
(10, 1, 1, 2, 'WORKSFORME', 1, 'resolution=WORKSFORME&product=Riccardo-ultraMobile', 1),
(11, 1, 1, 2, 'All Open', 1, 'bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&product=Riccardo-ultraMobile', 1),
(12, 1, 1, 3, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Riccardo-ultraMobile&component=ultraMobile', 1),
(13, 1, 1, 3, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Riccardo-ultraMobile&component=ultraMobile', 1),
(14, 1, 4, 5, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Riccardo&component=ultraComm', 1),
(15, 1, 4, 5, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Riccardo&component=ultraComm', 1),
(16, 1, 6, 2, 'UNCONFIRMED', 1, 'bug_status=UNCONFIRMED&product=Yves', 1),
(17, 1, 6, 2, 'CONFIRMED', 1, 'bug_status=CONFIRMED&product=Yves', 1),
(18, 1, 6, 2, 'IN_PROGRESS', 1, 'bug_status=IN_PROGRESS&product=Yves', 1),
(19, 1, 6, 2, 'RESOLVED', 1, 'bug_status=RESOLVED&product=Yves', 1),
(20, 1, 6, 2, 'VERIFIED', 1, 'bug_status=VERIFIED&product=Yves', 1),
(21, 1, 6, 2, 'FIXED', 1, 'resolution=FIXED&product=Yves', 1),
(22, 1, 6, 2, 'INVALID', 1, 'resolution=INVALID&product=Yves', 1),
(23, 1, 6, 2, 'WONTFIX', 1, 'resolution=WONTFIX&product=Yves', 1),
(24, 1, 6, 2, 'DUPLICATE', 1, 'resolution=DUPLICATE&product=Yves', 1),
(25, 1, 6, 2, 'WORKSFORME', 1, 'resolution=WORKSFORME&product=Yves', 1),
(26, 1, 6, 2, 'All Open', 1, 'bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&product=Yves', 1),
(27, 1, 6, 7, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Yves&component=WinForce', 1),
(28, 1, 6, 7, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Yves&component=WinForce', 1),
(29, 1, 6, 8, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Yves&component=sinema', 1),
(30, 1, 6, 8, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Yves&component=sinema', 1),
(31, 1, 9, 2, 'UNCONFIRMED', 1, 'bug_status=UNCONFIRMED&product=Sugar', 1),
(32, 1, 9, 2, 'CONFIRMED', 1, 'bug_status=CONFIRMED&product=Sugar', 1),
(33, 1, 9, 2, 'IN_PROGRESS', 1, 'bug_status=IN_PROGRESS&product=Sugar', 1),
(34, 1, 9, 2, 'RESOLVED', 1, 'bug_status=RESOLVED&product=Sugar', 1),
(35, 1, 9, 2, 'VERIFIED', 1, 'bug_status=VERIFIED&product=Sugar', 1),
(36, 1, 9, 2, 'FIXED', 1, 'resolution=FIXED&product=Sugar', 1),
(37, 1, 9, 2, 'INVALID', 1, 'resolution=INVALID&product=Sugar', 1),
(38, 1, 9, 2, 'WONTFIX', 1, 'resolution=WONTFIX&product=Sugar', 1),
(39, 1, 9, 2, 'DUPLICATE', 1, 'resolution=DUPLICATE&product=Sugar', 1),
(40, 1, 9, 2, 'WORKSFORME', 1, 'resolution=WORKSFORME&product=Sugar', 1),
(41, 1, 9, 2, 'All Open', 1, 'bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&product=Sugar', 1),
(42, 1, 9, 9, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Sugar&component=Sugar', 1),
(43, 1, 9, 9, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Sugar&component=Sugar', 1),
(44, 1, 10, 2, 'UNCONFIRMED', 1, 'bug_status=UNCONFIRMED&product=Proj2', 1),
(45, 1, 10, 2, 'CONFIRMED', 1, 'bug_status=CONFIRMED&product=Proj2', 1),
(46, 1, 10, 2, 'IN_PROGRESS', 1, 'bug_status=IN_PROGRESS&product=Proj2', 1),
(47, 1, 10, 2, 'RESOLVED', 1, 'bug_status=RESOLVED&product=Proj2', 1),
(48, 1, 10, 2, 'VERIFIED', 1, 'bug_status=VERIFIED&product=Proj2', 1),
(49, 1, 10, 2, 'FIXED', 1, 'resolution=FIXED&product=Proj2', 1),
(50, 1, 10, 2, 'INVALID', 1, 'resolution=INVALID&product=Proj2', 1),
(51, 1, 10, 2, 'WONTFIX', 1, 'resolution=WONTFIX&product=Proj2', 1),
(52, 1, 10, 2, 'DUPLICATE', 1, 'resolution=DUPLICATE&product=Proj2', 1),
(53, 1, 10, 2, 'WORKSFORME', 1, 'resolution=WORKSFORME&product=Proj2', 1),
(54, 1, 10, 2, 'All Open', 1, 'bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&product=Proj2', 1),
(55, 1, 10, 11, 'All Open', 1, 'field0-0-0=resolution&type0-0-0=notregexp&value0-0-0=.&product=Proj2&component=comp1', 1),
(56, 1, 10, 11, 'All Closed', 1, 'field0-0-0=resolution&type0-0-0=regexp&value0-0-0=.&product=Proj2&component=comp1', 1);

CREATE TABLE `series_categories` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `series_categories_name_idx` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=12 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `series_categories` VALUES
(2, '-All-'),
(11, 'comp1'),
(10, 'Proj2'),
(4, 'Riccardo'),
(1, 'Riccardo-ultraMobile'),
(8, 'sinema'),
(9, 'Sugar'),
(5, 'ultraComm'),
(3, 'ultraMobile'),
(7, 'WinForce'),
(6, 'Yves');

CREATE TABLE `series_data` (
  `series_id` mediumint(9) NOT NULL,
  `series_date` datetime NOT NULL,
  `series_value` mediumint(9) NOT NULL,
  UNIQUE KEY `series_data_series_id_idx` (`series_id`,`series_date`),
  CONSTRAINT `fk_series_data_series_id_series_series_id` FOREIGN KEY (`series_id`) REFERENCES `series` (`series_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `setting` (
  `name` varchar(32) NOT NULL,
  `default_value` varchar(32) NOT NULL,
  `is_enabled` tinyint(4) NOT NULL DEFAULT '1',
  `subclass` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`name`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `setting` VALUES
('comment_box_position', 'before_comments', 1, NULL),
('comment_sort_order', 'oldest_to_newest', 1, NULL),
('csv_colsepchar', ',', 1, NULL),
('display_quips', 'on', 1, NULL),
('lang', 'en', 1, 'Lang'),
('per_bug_queries', 'off', 1, NULL),
('post_bug_submit_action', 'next_bug', 1, NULL),
('quote_replies', 'quoted_reply', 1, NULL),
('skin', 'Dusk', 1, 'Skin'),
('state_addselfcc', 'cc_unless_role', 1, NULL),
('timezone', 'local', 1, 'Timezone'),
('zoom_textareas', 'on', 1, NULL);

CREATE TABLE `setting_value` (
  `name` varchar(32) NOT NULL,
  `value` varchar(32) NOT NULL,
  `sortindex` smallint(6) NOT NULL,
  UNIQUE KEY `setting_value_nv_unique_idx` (`name`,`value`),
  UNIQUE KEY `setting_value_ns_unique_idx` (`name`,`sortindex`),
  CONSTRAINT `fk_setting_value_name_setting_name` FOREIGN KEY (`name`) REFERENCES `setting` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `setting_value` VALUES
('comment_box_position', 'before_comments', 5),
('comment_box_position', 'after_comments', 10),
('comment_sort_order', 'oldest_to_newest', 5),
('comment_sort_order', 'newest_to_oldest', 10),
('comment_sort_order', 'newest_to_oldest_desc_first', 15),
('csv_colsepchar', ',', 5),
('csv_colsepchar', ';', 10),
('display_quips', 'on', 5),
('display_quips', 'off', 10),
('per_bug_queries', 'on', 5),
('per_bug_queries', 'off', 10),
('post_bug_submit_action', 'next_bug', 5),
('post_bug_submit_action', 'same_bug', 10),
('post_bug_submit_action', 'nothing', 15),
('quote_replies', 'quoted_reply', 5),
('quote_replies', 'simple_reply', 10),
('quote_replies', 'off', 15),
('state_addselfcc', 'always', 5),
('state_addselfcc', 'never', 10),
('state_addselfcc', 'cc_unless_role', 15),
('zoom_textareas', 'on', 5),
('zoom_textareas', 'off', 10);

CREATE TABLE `status_workflow` (
  `old_status` smallint(6) DEFAULT NULL,
  `new_status` smallint(6) NOT NULL,
  `require_comment` tinyint(4) NOT NULL DEFAULT '0',
  UNIQUE KEY `status_workflow_idx` (`old_status`,`new_status`),
  KEY `fk_status_workflow_new_status_bug_status_id` (`new_status`),
  CONSTRAINT `fk_status_workflow_new_status_bug_status_id` FOREIGN KEY (`new_status`) REFERENCES `bug_status` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_status_workflow_old_status_bug_status_id` FOREIGN KEY (`old_status`) REFERENCES `bug_status` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `status_workflow` VALUES
(NULL, 1, 0),
(NULL, 2, 0),
(NULL, 3, 0),
(1, 2, 0),
(1, 3, 0),
(1, 4, 0),
(2, 3, 0),
(2, 4, 0),
(3, 2, 0),
(3, 4, 0),
(4, 1, 0),
(4, 2, 0),
(4, 5, 0),
(5, 1, 0),
(5, 2, 0);

CREATE TABLE `ts_error` (
  `error_time` int(11) NOT NULL,
  `jobid` int(11) NOT NULL,
  `message` varchar(255) NOT NULL,
  `funcid` int(11) NOT NULL DEFAULT '0',
  KEY `ts_error_funcid_idx` (`funcid`,`error_time`),
  KEY `ts_error_error_time_idx` (`error_time`),
  KEY `ts_error_jobid_idx` (`jobid`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `ts_exitstatus` (
  `jobid` int(11) NOT NULL AUTO_INCREMENT,
  `funcid` int(11) NOT NULL DEFAULT '0',
  `status` smallint(6) DEFAULT NULL,
  `completion_time` int(11) DEFAULT NULL,
  `delete_after` int(11) DEFAULT NULL,
  PRIMARY KEY (`jobid`),
  KEY `ts_exitstatus_funcid_idx` (`funcid`),
  KEY `ts_exitstatus_delete_after_idx` (`delete_after`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `ts_funcmap` (
  `funcid` int(11) NOT NULL AUTO_INCREMENT,
  `funcname` varchar(255) NOT NULL,
  PRIMARY KEY (`funcid`),
  UNIQUE KEY `ts_funcmap_funcname_idx` (`funcname`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `ts_job` (
  `jobid` int(11) NOT NULL AUTO_INCREMENT,
  `funcid` int(11) NOT NULL,
  `arg` longblob,
  `uniqkey` varchar(255) DEFAULT NULL,
  `insert_time` int(11) DEFAULT NULL,
  `run_after` int(11) NOT NULL,
  `grabbed_until` int(11) NOT NULL,
  `priority` smallint(6) DEFAULT NULL,
  `coalesce` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`jobid`),
  UNIQUE KEY `ts_job_funcid_idx` (`funcid`,`uniqkey`),
  KEY `ts_job_run_after_idx` (`run_after`,`funcid`),
  KEY `ts_job_coalesce_idx` (`coalesce`,`funcid`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `ts_note` (
  `jobid` int(11) NOT NULL,
  `notekey` varchar(255) DEFAULT NULL,
  `value` longblob,
  UNIQUE KEY `ts_note_jobid_idx` (`jobid`,`notekey`)
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `user_group_map` (
  `user_id` mediumint(9) NOT NULL,
  `group_id` mediumint(9) NOT NULL,
  `isbless` tinyint(4) NOT NULL DEFAULT '0',
  `grant_type` tinyint(4) NOT NULL DEFAULT '0',
  UNIQUE KEY `user_group_map_user_id_idx` (`user_id`,`group_id`,`grant_type`,`isbless`),
  KEY `fk_user_group_map_group_id_groups_id` (`group_id`),
  CONSTRAINT `fk_user_group_map_group_id_groups_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_user_group_map_user_id_profiles_userid` FOREIGN KEY (`user_id`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `user_group_map` VALUES
(1, 1, 0, 0),
(1, 1, 1, 0),
(1, 3, 0, 0),
(1, 8, 0, 2),
(2, 8, 0, 0),
(2, 8, 0, 2),
(3, 8, 0, 2),
(4, 8, 0, 2),
(2, 14, 0, 0),
(2, 15, 0, 0);

CREATE TABLE `versions` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `value` varchar(64) NOT NULL,
  `product_id` smallint(6) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `versions_product_id_idx` (`product_id`,`value`),
  CONSTRAINT `fk_versions_product_id_products_id` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 /*!40101 DEFAULT CHARSET=utf8 */;

INSERT INTO `versions` VALUES
(1, 'unspecified', 1),
(2, 'unspecified', 2),
(3, 'unspecified', 3),
(4, 'unspecified', 4),
(5, 'unspecified', 5);

CREATE TABLE `watch` (
  `watcher` mediumint(9) NOT NULL,
  `watched` mediumint(9) NOT NULL,
  UNIQUE KEY `watch_watcher_idx` (`watcher`,`watched`),
  KEY `watch_watched_idx` (`watched`),
  CONSTRAINT `fk_watch_watched_profiles_userid` FOREIGN KEY (`watched`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_watch_watcher_profiles_userid` FOREIGN KEY (`watcher`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `whine_events` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `owner_userid` mediumint(9) NOT NULL,
  `subject` varchar(128) DEFAULT NULL,
  `body` mediumtext,
  `mailifnobugs` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_whine_events_owner_userid_profiles_userid` (`owner_userid`),
  CONSTRAINT `fk_whine_events_owner_userid_profiles_userid` FOREIGN KEY (`owner_userid`) REFERENCES `profiles` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `whine_queries` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `eventid` mediumint(9) NOT NULL,
  `query_name` varchar(64) NOT NULL DEFAULT '',
  `sortkey` smallint(6) NOT NULL DEFAULT '0',
  `onemailperbug` tinyint(4) NOT NULL DEFAULT '0',
  `title` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `whine_queries_eventid_idx` (`eventid`),
  CONSTRAINT `fk_whine_queries_eventid_whine_events_id` FOREIGN KEY (`eventid`) REFERENCES `whine_events` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

CREATE TABLE `whine_schedules` (
  `id` mediumint(9) NOT NULL AUTO_INCREMENT,
  `eventid` mediumint(9) NOT NULL,
  `run_day` varchar(32) DEFAULT NULL,
  `run_time` varchar(32) DEFAULT NULL,
  `run_next` datetime DEFAULT NULL,
  `mailto` mediumint(9) NOT NULL,
  `mailto_type` smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `whine_schedules_run_next_idx` (`run_next`),
  KEY `whine_schedules_eventid_idx` (`eventid`),
  CONSTRAINT `fk_whine_schedules_eventid_whine_events_id` FOREIGN KEY (`eventid`) REFERENCES `whine_events` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB /*!40101 DEFAULT CHARSET=utf8 */;

