1
0
mirror of https://git.osuv.de/m/gitea-mariadb-migration.git synced 2024-05-12 03:55:05 +00:00
Files
m-gitea-mariadb-migration/filtered_init.ddl
2018-08-21 23:15:38 +02:00

950 lines
32 KiB
SQL

DROP TABLE IF EXISTS `access`;
CREATE TABLE `access` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
`mode` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_access_s` (`user_id`,`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `access_token`;
CREATE TABLE `access_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`sha1` varchar(40) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_access_token_sha1` (`sha1`),
KEY `IDX_access_token_uid` (`uid`),
KEY `IDX_access_token_created_unix` (`created_unix`),
KEY `IDX_access_token_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `action`;
CREATE TABLE `action` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`op_type` int(11) DEFAULT NULL,
`act_user_id` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
`comment_id` bigint(20) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`ref_name` varchar(255) DEFAULT NULL,
`is_private` tinyint(1) NOT NULL DEFAULT 0,
`content` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_action_comment_id` (`comment_id`),
KEY `IDX_action_is_deleted` (`is_deleted`),
KEY `IDX_action_is_private` (`is_private`),
KEY `IDX_action_created_unix` (`created_unix`),
KEY `IDX_action_user_id` (`user_id`),
KEY `IDX_action_act_user_id` (`act_user_id`),
KEY `IDX_action_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `attachment`;
CREATE TABLE `attachment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uuid` varchar(40) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
`release_id` bigint(20) DEFAULT NULL,
`comment_id` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`download_count` bigint(20) DEFAULT 0,
`size` bigint(20) DEFAULT 0,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_attachment_uuid` (`uuid`),
KEY `IDX_attachment_issue_id` (`issue_id`),
KEY `IDX_attachment_release_id` (`release_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `collaboration`;
CREATE TABLE `collaboration` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`mode` int(11) NOT NULL DEFAULT 2,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_collaboration_s` (`repo_id`,`user_id`),
KEY `IDX_collaboration_repo_id` (`repo_id`),
KEY `IDX_collaboration_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT NULL,
`poster_id` bigint(20) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
`label_id` bigint(20) DEFAULT NULL,
`old_milestone_id` bigint(20) DEFAULT NULL,
`milestone_id` bigint(20) DEFAULT NULL,
`assignee_id` bigint(20) DEFAULT NULL,
`removed_assignee` tinyint(1) DEFAULT NULL,
`old_title` varchar(255) DEFAULT NULL,
`new_title` varchar(255) DEFAULT NULL,
`dependent_issue_id` bigint(20) DEFAULT NULL,
`commit_id` bigint(20) DEFAULT NULL,
`line` bigint(20) DEFAULT NULL,
`tree_path` varchar(255) DEFAULT NULL,
`content` text DEFAULT NULL,
`patch` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
`commit_sha` varchar(40) DEFAULT NULL,
`review_id` bigint(20) DEFAULT NULL,
`invalidated` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_comment_poster_id` (`poster_id`),
KEY `IDX_comment_issue_id` (`issue_id`),
KEY `IDX_comment_created_unix` (`created_unix`),
KEY `IDX_comment_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `commit_status`;
CREATE TABLE `commit_status` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`index` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
`state` varchar(7) NOT NULL,
`sha` varchar(64) NOT NULL,
`target_url` text DEFAULT NULL,
`description` text DEFAULT NULL,
`context` text DEFAULT NULL,
`creator_id` bigint(20) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_commit_status_repo_sha_index` (`index`,`repo_id`,`sha`),
KEY `IDX_commit_status_index` (`index`),
KEY `IDX_commit_status_repo_id` (`repo_id`),
KEY `IDX_commit_status_sha` (`sha`),
KEY `IDX_commit_status_created_unix` (`created_unix`),
KEY `IDX_commit_status_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `deleted_branch`;
CREATE TABLE `deleted_branch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) NOT NULL,
`name` varchar(255) NOT NULL,
`commit` varchar(255) NOT NULL,
`deleted_by_id` bigint(20) DEFAULT NULL,
`deleted_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_deleted_branch_s` (`repo_id`,`name`,`commit`),
KEY `IDX_deleted_branch_deleted_by_id` (`deleted_by_id`),
KEY `IDX_deleted_branch_deleted_unix` (`deleted_unix`),
KEY `IDX_deleted_branch_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `deploy_key`;
CREATE TABLE `deploy_key` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`key_id` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`fingerprint` varchar(255) DEFAULT NULL,
`mode` int(11) NOT NULL DEFAULT 1,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_deploy_key_s` (`key_id`,`repo_id`),
KEY `IDX_deploy_key_key_id` (`key_id`),
KEY `IDX_deploy_key_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `email_address`;
CREATE TABLE `email_address` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) NOT NULL,
`email` varchar(255) NOT NULL,
`is_activated` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_email_address_email` (`email`),
KEY `IDX_email_address_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `external_login_user`;
CREATE TABLE `external_login_user` (
`external_id` varchar(255) NOT NULL,
`user_id` bigint(20) NOT NULL,
`login_source_id` bigint(20) NOT NULL,
PRIMARY KEY (`external_id`,`login_source_id`),
KEY `IDX_external_login_user_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `follow`;
CREATE TABLE `follow` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`follow_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_follow_follow` (`user_id`,`follow_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `gpg_key`;
CREATE TABLE `gpg_key` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`owner_id` bigint(20) NOT NULL,
`key_id` char(16) NOT NULL,
`primary_key_id` char(16) DEFAULT NULL,
`content` text NOT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`expired_unix` bigint(20) DEFAULT NULL,
`added_unix` bigint(20) DEFAULT NULL,
`emails` text DEFAULT NULL,
`can_sign` tinyint(1) DEFAULT NULL,
`can_encrypt_comms` tinyint(1) DEFAULT NULL,
`can_encrypt_storage` tinyint(1) DEFAULT NULL,
`can_certify` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_gpg_key_owner_id` (`owner_id`),
KEY `IDX_gpg_key_key_id` (`key_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `hook_task`;
CREATE TABLE `hook_task` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`hook_id` bigint(20) DEFAULT NULL,
`uuid` varchar(255) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`url` text DEFAULT NULL,
`payload_content` text DEFAULT NULL,
`content_type` int(11) DEFAULT NULL,
`event_type` varchar(255) DEFAULT NULL,
`is_ssl` tinyint(1) DEFAULT NULL,
`is_delivered` tinyint(1) DEFAULT NULL,
`delivered` bigint(20) DEFAULT NULL,
`is_succeed` tinyint(1) DEFAULT NULL,
`request_content` text DEFAULT NULL,
`response_content` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_hook_task_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue`;
CREATE TABLE `issue` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`index` bigint(20) DEFAULT NULL,
`poster_id` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`content` text DEFAULT NULL,
`milestone_id` bigint(20) DEFAULT NULL,
`priority` int(11) DEFAULT NULL,
`is_closed` tinyint(1) DEFAULT NULL,
`is_pull` tinyint(1) DEFAULT NULL,
`num_comments` int(11) DEFAULT NULL,
`ref` varchar(255) DEFAULT NULL,
`deadline_unix` bigint(20) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
`closed_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_issue_repo_index` (`repo_id`,`index`),
KEY `IDX_issue_is_closed` (`is_closed`),
KEY `IDX_issue_is_pull` (`is_pull`),
KEY `IDX_issue_deadline_unix` (`deadline_unix`),
KEY `IDX_issue_created_unix` (`created_unix`),
KEY `IDX_issue_updated_unix` (`updated_unix`),
KEY `IDX_issue_closed_unix` (`closed_unix`),
KEY `IDX_issue_repo_id` (`repo_id`),
KEY `IDX_issue_poster_id` (`poster_id`),
KEY `IDX_issue_milestone_id` (`milestone_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue_assignees`;
CREATE TABLE `issue_assignees` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`assignee_id` bigint(20) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_issue_assignees_issue_id` (`issue_id`),
KEY `IDX_issue_assignees_assignee_id` (`assignee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue_dependency`;
CREATE TABLE `issue_dependency` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`issue_id` bigint(20) NOT NULL,
`dependency_id` bigint(20) NOT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_issue_dependency_issue_dependency` (`issue_id`,`dependency_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue_label`;
CREATE TABLE `issue_label` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`issue_id` bigint(20) DEFAULT NULL,
`label_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_issue_label_s` (`issue_id`,`label_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue_user`;
CREATE TABLE `issue_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
`is_read` tinyint(1) DEFAULT NULL,
`is_mentioned` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_issue_user_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `issue_watch`;
CREATE TABLE `issue_watch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`issue_id` bigint(20) NOT NULL,
`is_watching` tinyint(1) NOT NULL,
`created_unix` bigint(20) NOT NULL,
`updated_unix` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_issue_watch_watch` (`user_id`,`issue_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `label`;
CREATE TABLE `label` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`color` varchar(7) DEFAULT NULL,
`num_issues` int(11) DEFAULT NULL,
`num_closed_issues` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_label_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `lfs_lock`;
CREATE TABLE `lfs_lock` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) NOT NULL,
`owner_id` bigint(20) NOT NULL,
`path` text DEFAULT NULL,
`created` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_lfs_lock_repo_id` (`repo_id`),
KEY `IDX_lfs_lock_owner_id` (`owner_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `lfs_meta_object`;
CREATE TABLE `lfs_meta_object` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`oid` varchar(255) NOT NULL,
`size` bigint(20) NOT NULL,
`repository_id` bigint(20) NOT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_lfs_meta_object_s` (`oid`,`repository_id`),
KEY `IDX_lfs_meta_object_oid` (`oid`),
KEY `IDX_lfs_meta_object_repository_id` (`repository_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `login_source`;
CREATE TABLE `login_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`is_actived` tinyint(1) NOT NULL DEFAULT 0,
`is_sync_enabled` tinyint(1) NOT NULL DEFAULT 0,
`cfg` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_login_source_name` (`name`),
KEY `IDX_login_source_is_actived` (`is_actived`),
KEY `IDX_login_source_is_sync_enabled` (`is_sync_enabled`),
KEY `IDX_login_source_created_unix` (`created_unix`),
KEY `IDX_login_source_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `milestone`;
CREATE TABLE `milestone` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`content` text DEFAULT NULL,
`is_closed` tinyint(1) DEFAULT NULL,
`num_issues` int(11) DEFAULT NULL,
`num_closed_issues` int(11) DEFAULT NULL,
`completeness` int(11) DEFAULT NULL,
`deadline_unix` bigint(20) DEFAULT NULL,
`closed_date_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_milestone_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `mirror`;
CREATE TABLE `mirror` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`interval` bigint(20) DEFAULT NULL,
`enable_prune` tinyint(1) NOT NULL DEFAULT 1,
`updated_unix` bigint(20) DEFAULT NULL,
`next_update_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_mirror_updated_unix` (`updated_unix`),
KEY `IDX_mirror_next_update_unix` (`next_update_unix`),
KEY `IDX_mirror_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT NULL,
`description` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_notice_created_unix` (`created_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `notification`;
CREATE TABLE `notification` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`repo_id` bigint(20) NOT NULL,
`status` smallint(6) NOT NULL,
`source` smallint(6) NOT NULL,
`issue_id` bigint(20) NOT NULL,
`commit_id` varchar(255) DEFAULT NULL,
`updated_by` bigint(20) NOT NULL,
`created_unix` bigint(20) NOT NULL,
`updated_unix` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_notification_repo_id` (`repo_id`),
KEY `IDX_notification_status` (`status`),
KEY `IDX_notification_issue_id` (`issue_id`),
KEY `IDX_notification_user_id` (`user_id`),
KEY `IDX_notification_commit_id` (`commit_id`),
KEY `IDX_notification_updated_by` (`updated_by`),
KEY `IDX_notification_created_unix` (`created_unix`),
KEY `IDX_notification_updated_unix` (`updated_unix`),
KEY `IDX_notification_source` (`source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `oauth2_session`;
CREATE TABLE `oauth2_session` (
`id` varchar(100) NOT NULL,
`data` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
`expires_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_oauth2_session_expires_unix` (`expires_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `org_user`;
CREATE TABLE `org_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL,
`org_id` bigint(20) DEFAULT NULL,
`is_public` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_org_user_s` (`uid`,`org_id`),
KEY `IDX_org_user_org_id` (`org_id`),
KEY `IDX_org_user_is_public` (`is_public`),
KEY `IDX_org_user_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `protected_branch`;
CREATE TABLE `protected_branch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`branch_name` varchar(255) DEFAULT NULL,
`can_push` tinyint(1) NOT NULL DEFAULT 0,
`enable_whitelist` tinyint(1) DEFAULT NULL,
`whitelist_user_i_ds` text DEFAULT NULL,
`whitelist_team_i_ds` text DEFAULT NULL,
`enable_merge_whitelist` tinyint(1) NOT NULL DEFAULT 0,
`merge_whitelist_user_i_ds` text DEFAULT NULL,
`merge_whitelist_team_i_ds` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_protected_branch_s` (`repo_id`,`branch_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `public_key`;
CREATE TABLE `public_key` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`owner_id` bigint(20) NOT NULL,
`name` varchar(255) NOT NULL,
`fingerprint` varchar(255) NOT NULL,
`content` text NOT NULL,
`mode` int(11) NOT NULL DEFAULT 2,
`type` int(11) NOT NULL DEFAULT 1,
`login_source_id` bigint(20) NOT NULL DEFAULT 0,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_public_key_owner_id` (`owner_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `pull_request`;
CREATE TABLE `pull_request` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
`index` bigint(20) DEFAULT NULL,
`head_repo_id` bigint(20) DEFAULT NULL,
`base_repo_id` bigint(20) DEFAULT NULL,
`head_user_name` varchar(255) DEFAULT NULL,
`head_branch` varchar(255) DEFAULT NULL,
`base_branch` varchar(255) DEFAULT NULL,
`merge_base` varchar(40) DEFAULT NULL,
`has_merged` tinyint(1) DEFAULT NULL,
`merged_commit_id` varchar(40) DEFAULT NULL,
`merger_id` bigint(20) DEFAULT NULL,
`merged_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_pull_request_base_repo_id` (`base_repo_id`),
KEY `IDX_pull_request_has_merged` (`has_merged`),
KEY `IDX_pull_request_merger_id` (`merger_id`),
KEY `IDX_pull_request_merged_unix` (`merged_unix`),
KEY `IDX_pull_request_issue_id` (`issue_id`),
KEY `IDX_pull_request_head_repo_id` (`head_repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `reaction`;
CREATE TABLE `reaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(255) NOT NULL,
`issue_id` bigint(20) NOT NULL,
`comment_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) NOT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_reaction_s` (`type`,`issue_id`,`comment_id`,`user_id`),
KEY `IDX_reaction_issue_id` (`issue_id`),
KEY `IDX_reaction_comment_id` (`comment_id`),
KEY `IDX_reaction_user_id` (`user_id`),
KEY `IDX_reaction_created_unix` (`created_unix`),
KEY `IDX_reaction_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `release`;
CREATE TABLE `release` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`publisher_id` bigint(20) DEFAULT NULL,
`tag_name` varchar(255) DEFAULT NULL,
`lower_tag_name` varchar(255) DEFAULT NULL,
`target` varchar(255) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`sha1` varchar(40) DEFAULT NULL,
`num_commits` bigint(20) DEFAULT NULL,
`note` text DEFAULT NULL,
`is_draft` tinyint(1) NOT NULL DEFAULT 0,
`is_prerelease` tinyint(1) NOT NULL DEFAULT 0,
`is_tag` tinyint(1) NOT NULL DEFAULT 0,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_release_n` (`repo_id`,`tag_name`),
KEY `IDX_release_repo_id` (`repo_id`),
KEY `IDX_release_publisher_id` (`publisher_id`),
KEY `IDX_release_tag_name` (`tag_name`),
KEY `IDX_release_created_unix` (`created_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `repo_indexer_status`;
CREATE TABLE `repo_indexer_status` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`commit_sha` varchar(40) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_repo_indexer_status_repo_id` (`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `repo_redirect`;
CREATE TABLE `repo_redirect` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`owner_id` bigint(20) DEFAULT NULL,
`lower_name` varchar(255) NOT NULL,
`redirect_repo_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_repo_redirect_s` (`owner_id`,`lower_name`),
KEY `IDX_repo_redirect_lower_name` (`lower_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `repo_topic`;
CREATE TABLE `repo_topic` (
`repo_id` bigint(20) DEFAULT NULL,
`topic_id` bigint(20) DEFAULT NULL,
UNIQUE KEY `UQE_repo_topic_s` (`repo_id`,`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `repo_unit`;
CREATE TABLE `repo_unit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`config` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_repo_unit_s` (`repo_id`,`type`),
KEY `IDX_repo_unit_created_unix` (`created_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `repository`;
CREATE TABLE `repository` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`owner_id` bigint(20) DEFAULT NULL,
`lower_name` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`default_branch` varchar(255) DEFAULT NULL,
`num_watches` int(11) DEFAULT NULL,
`num_stars` int(11) DEFAULT NULL,
`num_forks` int(11) DEFAULT NULL,
`num_issues` int(11) DEFAULT NULL,
`num_closed_issues` int(11) DEFAULT NULL,
`num_pulls` int(11) DEFAULT NULL,
`num_closed_pulls` int(11) DEFAULT NULL,
`num_milestones` int(11) NOT NULL DEFAULT 0,
`num_closed_milestones` int(11) NOT NULL DEFAULT 0,
`is_private` tinyint(1) DEFAULT NULL,
`is_bare` tinyint(1) DEFAULT NULL,
`is_mirror` tinyint(1) DEFAULT NULL,
`is_fork` tinyint(1) NOT NULL DEFAULT 0,
`fork_id` bigint(20) DEFAULT NULL,
`size` bigint(20) NOT NULL DEFAULT 0,
`is_fsck_enabled` tinyint(1) NOT NULL DEFAULT 1,
`topics` text DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_repository_s` (`owner_id`,`lower_name`),
KEY `IDX_repository_name` (`name`),
KEY `IDX_repository_is_bare` (`is_bare`),
KEY `IDX_repository_fork_id` (`fork_id`),
KEY `IDX_repository_lower_name` (`lower_name`),
KEY `IDX_repository_is_private` (`is_private`),
KEY `IDX_repository_is_mirror` (`is_mirror`),
KEY `IDX_repository_is_fork` (`is_fork`),
KEY `IDX_repository_created_unix` (`created_unix`),
KEY `IDX_repository_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `review`;
CREATE TABLE `review` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT NULL,
`reviewer_id` bigint(20) DEFAULT NULL,
`issue_id` bigint(20) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_review_reviewer_id` (`reviewer_id`),
KEY `IDX_review_issue_id` (`issue_id`),
KEY `IDX_review_created_unix` (`created_unix`),
KEY `IDX_review_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `star`;
CREATE TABLE `star` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_star_s` (`uid`,`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `stopwatch`;
CREATE TABLE `stopwatch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`issue_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_stopwatch_issue_id` (`issue_id`),
KEY `IDX_stopwatch_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `team`;
CREATE TABLE `team` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) DEFAULT NULL,
`lower_name` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`authorize` int(11) DEFAULT NULL,
`num_repos` int(11) DEFAULT NULL,
`num_members` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_team_org_id` (`org_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `team_repo`;
CREATE TABLE `team_repo` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) DEFAULT NULL,
`team_id` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_team_repo_s` (`team_id`,`repo_id`),
KEY `IDX_team_repo_org_id` (`org_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `team_unit`;
CREATE TABLE `team_unit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) DEFAULT NULL,
`team_id` bigint(20) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_team_unit_s` (`team_id`,`type`),
KEY `IDX_team_unit_org_id` (`org_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `team_user`;
CREATE TABLE `team_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) DEFAULT NULL,
`team_id` bigint(20) DEFAULT NULL,
`uid` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_team_user_s` (`team_id`,`uid`),
KEY `IDX_team_user_org_id` (`org_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `topic`;
CREATE TABLE `topic` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`repo_count` int(11) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_topic_name` (`name`),
KEY `IDX_topic_created_unix` (`created_unix`),
KEY `IDX_topic_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `tracked_time`;
CREATE TABLE `tracked_time` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`issue_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`time` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_tracked_time_issue_id` (`issue_id`),
KEY `IDX_tracked_time_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `two_factor`;
CREATE TABLE `two_factor` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) DEFAULT NULL,
`secret` varchar(255) DEFAULT NULL,
`scratch_salt` varchar(255) DEFAULT NULL,
`scratch_hash` varchar(255) DEFAULT NULL,
`last_used_passcode` varchar(10) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_two_factor_uid` (`uid`),
KEY `IDX_two_factor_created_unix` (`created_unix`),
KEY `IDX_two_factor_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `u2f_registration`;
CREATE TABLE `u2f_registration` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`raw` blob DEFAULT NULL,
`counter` int(11) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_u2f_registration_user_id` (`user_id`),
KEY `IDX_u2f_registration_created_unix` (`created_unix`),
KEY `IDX_u2f_registration_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `upload`;
CREATE TABLE `upload` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uuid` varchar(40) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_upload_uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`lower_name` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`full_name` varchar(255) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`keep_email_private` tinyint(1) DEFAULT NULL,
`passwd` varchar(255) NOT NULL,
`login_type` int(11) DEFAULT NULL,
`login_source` bigint(20) NOT NULL DEFAULT 0,
`login_name` varchar(255) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`rands` varchar(10) DEFAULT NULL,
`salt` varchar(10) DEFAULT NULL,
`language` varchar(5) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
`last_login_unix` bigint(20) DEFAULT NULL,
`last_repo_visibility` tinyint(1) DEFAULT NULL,
`max_repo_creation` int(11) NOT NULL DEFAULT -1,
`is_active` tinyint(1) DEFAULT NULL,
`is_admin` tinyint(1) DEFAULT NULL,
`allow_git_hook` tinyint(1) DEFAULT NULL,
`allow_import_local` tinyint(1) DEFAULT NULL,
`allow_create_organization` tinyint(1) DEFAULT 1,
`prohibit_login` tinyint(1) NOT NULL DEFAULT 0,
`avatar` varchar(2048) NOT NULL,
`avatar_email` varchar(255) NOT NULL,
`use_custom_avatar` tinyint(1) DEFAULT NULL,
`num_followers` int(11) DEFAULT NULL,
`num_following` int(11) NOT NULL DEFAULT 0,
`num_stars` int(11) DEFAULT NULL,
`num_repos` int(11) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`num_teams` int(11) DEFAULT NULL,
`num_members` int(11) DEFAULT NULL,
`diff_view_style` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_user_lower_name` (`lower_name`),
UNIQUE KEY `UQE_user_name` (`name`),
KEY `IDX_user_created_unix` (`created_unix`),
KEY `IDX_user_updated_unix` (`updated_unix`),
KEY `IDX_user_last_login_unix` (`last_login_unix`),
KEY `IDX_user_is_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `user_open_id`;
CREATE TABLE `user_open_id` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) NOT NULL,
`uri` varchar(255) NOT NULL,
`show` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_user_open_id_uri` (`uri`),
KEY `IDX_user_open_id_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `version`;
CREATE TABLE `version` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`version` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `watch`;
CREATE TABLE `watch` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`repo_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQE_watch_watch` (`user_id`,`repo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `webhook`;
CREATE TABLE `webhook` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`repo_id` bigint(20) DEFAULT NULL,
`org_id` bigint(20) DEFAULT NULL,
`url` text DEFAULT NULL,
`content_type` int(11) DEFAULT NULL,
`secret` text DEFAULT NULL,
`events` text DEFAULT NULL,
`is_ssl` tinyint(1) DEFAULT NULL,
`is_active` tinyint(1) DEFAULT NULL,
`hook_task_type` int(11) DEFAULT NULL,
`meta` text DEFAULT NULL,
`last_status` int(11) DEFAULT NULL,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `IDX_webhook_repo_id` (`repo_id`),
KEY `IDX_webhook_org_id` (`org_id`),
KEY `IDX_webhook_is_active` (`is_active`),
KEY `IDX_webhook_created_unix` (`created_unix`),
KEY `IDX_webhook_updated_unix` (`updated_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;