此SQL脚本是2.14.5.1版本。不同版本之间SQL会有些差异,请注意比对,最好是去使用gerrit.war包进行初始化操作。
/*
MySQL - 5.6.32 : Database - reviewdb
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`reviewdb` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `reviewdb`;
/*Table structure for table `account_external_ids` */
DROP TABLE IF EXISTS `account_external_ids`;
CREATE TABLE `account_external_ids` (
`account_id` int(11) NOT NULL DEFAULT '0',
`email_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`external_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`external_id`),
KEY `account_external_ids_byAccount` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_external_ids` */
/*Table structure for table `account_group_by_id` */
DROP TABLE IF EXISTS `account_group_by_id`;
CREATE TABLE `account_group_by_id` (
`group_id` int(11) NOT NULL DEFAULT '0',
`include_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`group_id`,`include_uuid`),
KEY `account_group_id_byInclude` (`include_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_group_by_id` */
/*Table structure for table `account_group_by_id_aud` */
DROP TABLE IF EXISTS `account_group_by_id_aud`;
CREATE TABLE `account_group_by_id_aud` (
`added_by` int(11) NOT NULL DEFAULT '0',
`removed_by` int(11) DEFAULT NULL,
`removed_on` timestamp NULL DEFAULT NULL,
`group_id` int(11) NOT NULL DEFAULT '0',
`include_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`added_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`group_id`,`include_uuid`,`added_on`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_group_by_id_aud` */
/*Table structure for table `account_group_id` */
DROP TABLE IF EXISTS `account_group_id`;
CREATE TABLE `account_group_id` (
`s` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `s` (`s`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `account_group_id` */
insert into `account_group_id`(`s`) values (1),(2);
/*Table structure for table `account_group_members` */
DROP TABLE IF EXISTS `account_group_members`;
CREATE TABLE `account_group_members` (
`account_id` int(11) NOT NULL DEFAULT '0',
`group_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`account_id`,`group_id`),
KEY `account_group_members_byGroup` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_group_members` */
/*Table structure for table `account_group_members_audit` */
DROP TABLE IF EXISTS `account_group_members_audit`;
CREATE TABLE `account_group_members_audit` (
`added_by` int(11) NOT NULL DEFAULT '0',
`removed_by` int(11) DEFAULT NULL,
`removed_on` timestamp NULL DEFAULT NULL,
`account_id` int(11) NOT NULL DEFAULT '0',
`group_id` int(11) NOT NULL DEFAULT '0',
`added_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`account_id`,`group_id`,`added_on`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_group_members_audit` */
/*Table structure for table `account_group_names` */
DROP TABLE IF EXISTS `account_group_names`;
CREATE TABLE `account_group_names` (
`group_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_group_names` */
insert into `account_group_names`(`group_id`,`name`) values (1,'Administrators'),(2,'Non-Interactive Users');
/*Table structure for table `account_groups` */
DROP TABLE IF EXISTS `account_groups`;
CREATE TABLE `account_groups` (
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`description` text,
`visible_to_all` char(1) NOT NULL DEFAULT 'N',
`group_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`owner_group_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`group_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_groups` */
insert into `account_groups`(`name`,`description`,`visible_to_all`,`group_uuid`,`owner_group_uuid`,`group_id`) values ('Administrators','Gerrit Site Administrators','N','d2a1ec3d04c1cdc13bb0241035b2da5eea160c89','d2a1ec3d04c1cdc13bb0241035b2da5eea160c89',1),('Non-Interactive Users','Users who perform batch actions on Gerrit','N','5ed13e2523132d5a26504b6684024391791ea75c','d2a1ec3d04c1cdc13bb0241035b2da5eea160c89',2);
/*Table structure for table `account_id` */
DROP TABLE IF EXISTS `account_id`;
CREATE TABLE `account_id` (
`s` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `s` (`s`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `account_id` */
/*Table structure for table `accounts` */
DROP TABLE IF EXISTS `accounts`;
CREATE TABLE `accounts` (
`registered_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`full_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`preferred_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`inactive` char(1) NOT NULL DEFAULT 'N',
`status` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`account_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`account_id`),
KEY `accounts_byPreferredEmail` (`preferred_email`),
KEY `accounts_byFullName` (`full_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `accounts` */
/*Table structure for table `change_id` */
DROP TABLE IF EXISTS `change_id`;
CREATE TABLE `change_id` (
`s` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `s` (`s`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `change_id` */
/*Table structure for table `change_messages` */
DROP TABLE IF EXISTS `change_messages`;
CREATE TABLE `change_messages` (
`author_id` int(11) DEFAULT NULL,
`written_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`message` text,
`patchset_change_id` int(11) DEFAULT NULL,
`patchset_patch_set_id` int(11) DEFAULT NULL,
`tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`real_author` int(11) DEFAULT NULL,
`change_id` int(11) NOT NULL DEFAULT '0',
`uuid` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`change_id`,`uuid`),
KEY `change_messages_byPatchset` (`patchset_change_id`,`patchset_patch_set_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `change_messages` */
/*Table structure for table `changes` */
DROP TABLE IF EXISTS `changes`;
CREATE TABLE `changes` (
`change_key` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`last_updated_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`owner_account_id` int(11) NOT NULL DEFAULT '0',
`dest_project_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`dest_branch_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`status` char(1) NOT NULL DEFAULT '',
`current_patch_set_id` int(11) NOT NULL DEFAULT '0',
`subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`topic` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`original_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`submission_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`assignee` int(11) DEFAULT NULL,
`note_db_state` text,
`row_version` int(11) NOT NULL DEFAULT '0',
`change_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`change_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `changes` */
/*Table structure for table `patch_comments` */
DROP TABLE IF EXISTS `patch_comments`;
CREATE TABLE `patch_comments` (
`line_nbr` int(11) NOT NULL DEFAULT '0',
`author_id` int(11) NOT NULL DEFAULT '0',
`written_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` char(1) NOT NULL DEFAULT '',
`side` smallint(6) NOT NULL DEFAULT '0',
`message` text,
`parent_uuid` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`range_start_line` int(11) DEFAULT NULL,
`range_start_character` int(11) DEFAULT NULL,
`range_end_line` int(11) DEFAULT NULL,
`range_end_character` int(11) DEFAULT NULL,
`tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`real_author` int(11) DEFAULT NULL,
`unresolved` char(1) NOT NULL DEFAULT 'N',
`change_id` int(11) NOT NULL DEFAULT '0',
`patch_set_id` int(11) NOT NULL DEFAULT '0',
`file_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`uuid` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`change_id`,`patch_set_id`,`file_name`,`uuid`),
KEY `patch_comment_drafts` (`status`,`author_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `patch_comments` */
/*Table structure for table `patch_set_approvals` */
DROP TABLE IF EXISTS `patch_set_approvals`;
CREATE TABLE `patch_set_approvals` (
`value` smallint(6) NOT NULL DEFAULT '0',
`granted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`real_account_id` int(11) DEFAULT NULL,
`post_submit` char(1) NOT NULL DEFAULT 'N',
`change_id` int(11) NOT NULL DEFAULT '0',
`patch_set_id` int(11) NOT NULL DEFAULT '0',
`account_id` int(11) NOT NULL DEFAULT '0',
`category_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`change_id`,`patch_set_id`,`account_id`,`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `patch_set_approvals` */
/*Table structure for table `patch_sets` */
DROP TABLE IF EXISTS `patch_sets`;
CREATE TABLE `patch_sets` (
`revision` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`uploader_account_id` int(11) NOT NULL DEFAULT '0',
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`draft` char(1) NOT NULL DEFAULT 'N',
`groups` text,
`push_certificate` text,
`description` text,
`change_id` int(11) NOT NULL DEFAULT '0',
`patch_set_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`change_id`,`patch_set_id`),
KEY `patch_sets_byRevision` (`revision`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `patch_sets` */
/*Table structure for table `schema_version` */
DROP TABLE IF EXISTS `schema_version`;
CREATE TABLE `schema_version` (
`version_nbr` int(11) NOT NULL DEFAULT '0',
`singleton` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`singleton`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `schema_version` */
insert into `schema_version`(`version_nbr`,`singleton`) values (142,'X');
/*Table structure for table `system_config` */
DROP TABLE IF EXISTS `system_config`;
CREATE TABLE `system_config` (
`register_email_private_key` varchar(36) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`site_path` text,
`admin_group_id` int(11) DEFAULT NULL,
`anonymous_group_id` int(11) DEFAULT NULL,
`registered_group_id` int(11) DEFAULT NULL,
`wild_project_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`batch_users_group_id` int(11) DEFAULT NULL,
`owner_group_id` int(11) DEFAULT NULL,
`admin_group_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`batch_users_group_uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`singleton` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`singleton`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `system_config` */
insert into `system_config`(`register_email_private_key`,`site_path`,`admin_group_id`,`anonymous_group_id`,`registered_group_id`,`wild_project_name`,`batch_users_group_id`,`owner_group_id`,`admin_group_uuid`,`batch_users_group_uuid`,`singleton`) values (NULL,'E:\\gerrit_site',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'X');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;