gerrit 2.15.x 版本 数据库表介绍 之 postgresql 数据库

下面是2.15.x 版本的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                    List of relations
Schema | Name | Type | Owner
--------+-----------------------------+----------+--------
public | account_group_by_id | table | gerrit
public | account_group_by_id_aud | table | gerrit
public | account_group_id | sequence | gerrit
public | account_group_members | table | gerrit
public | account_group_members_audit | table | gerrit
public | account_group_names | table | gerrit
public | account_groups | table | gerrit
public | account_id | sequence | gerrit
public | change_id | sequence | gerrit
public | change_messages | table | gerrit
public | changes | table | gerrit
public | patch_comments | table | gerrit
public | patch_set_approvals | table | gerrit
public | patch_sets | table | gerrit
public | schema_version | table | gerrit
public | system_config | table | gerrit
(16 rows)

List of relations
Schema | Name | Type | Owner
--------+------------------+----------+----------
public | account_group_id | sequence | postgres
public | account_id | sequence | postgres
public | change_id | sequence | postgres
(3 rows)

List of relations
Schema | Name | Type | Owner
--------+-----------------------------+-------+----------
public | account_group_by_id | table | postgres
public | account_group_by_id_aud | table | postgres
public | account_group_members | table | postgres
public | account_group_members_audit | table | postgres
public | account_group_names | table | postgres
public | account_groups | table | postgres
public | change_messages | table | postgres
public | changes | table | postgres
public | patch_comments | table | postgres
public | patch_set_approvals | table | postgres
public | patch_sets | table | postgres
public | schema_version | table | postgres
public | system_config | table | postgres
(13 rows)

下面是2.12.x 版本的 数据库表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

List of relations
Schema | Name | Type | Owner
--------+-----------------------------+----------+--------
public | account_external_ids | table | gerrit
public | account_group_by_id | table | gerrit
public | account_group_by_id_aud | table | gerrit
public | account_group_id | sequence | gerrit
public | account_group_members | table | gerrit
public | account_group_members_audit | table | gerrit
public | account_group_names | table | gerrit
public | account_groups | table | gerrit
public | account_id | sequence | gerrit
public | account_patch_reviews | table | gerrit
public | account_project_watches | table | gerrit
public | account_ssh_keys | table | gerrit
public | accounts | table | gerrit
public | change_id | sequence | gerrit
public | change_message_id | sequence | gerrit
public | change_messages | table | gerrit
public | changes | table | gerrit
public | patch_comments | table | gerrit
public | patch_set_approvals | table | gerrit
public | patch_sets | table | gerrit
public | schema_version | table | gerrit
public | starred_changes | table | gerrit
public | submodule_subscriptions | table | gerrit
public | system_config | table | gerrit
(24 rows)

List of relations
Schema | Name | Type | Owner
--------+-------------------+----------+--------
public | account_group_id | sequence | gerrit
public | account_id | sequence | gerrit
public | change_id | sequence | gerrit
public | change_message_id | sequence | gerrit
(4 rows)

List of relations
Schema | Name | Type | Owner
--------+-----------------------------+-------+--------
public | account_external_ids | table | gerrit
public | account_group_by_id | table | gerrit
public | account_group_by_id_aud | table | gerrit
public | account_group_members | table | gerrit
public | account_group_members_audit | table | gerrit
public | account_group_names | table | gerrit
public | account_groups | table | gerrit
public | account_patch_reviews | table | gerrit
public | account_project_watches | table | gerrit
public | account_ssh_keys | table | gerrit
public | accounts | table | gerrit
public | change_messages | table | gerrit
public | changes | table | gerrit
public | patch_comments | table | gerrit
public | patch_set_approvals | table | gerrit
public | patch_sets | table | gerrit
public | schema_version | table | gerrit
public | starred_changes | table | gerrit
public | submodule_subscriptions | table | gerrit
public | system_config | table | gerrit
(20 rows)

1
2
3
4
5
6
7
8
9
account_group_by_id
Table "public.account_group_by_id"
Column | Type | Collation | Nullable | Default
--------------+------------------------+-----------+----------+-----------------------
group_id | integer | | not null | 0
include_uuid | character varying(255) | | not null | ''::character varying
Indexes:
"account_group_by_id_pkey" PRIMARY KEY, btree (group_id, include_uuid)
"account_group_id_byinclude" btree (include_uuid)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
account_group_by_id_aud
Table "public.account_group_by_id_aud"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+-----------------------
added_by | integer | | not null | 0
removed_by | integer | | |
removed_on | timestamp with time zone | | |
group_id | integer | | not null | 0
include_uuid | character varying(255) | | not null | ''::character varying
added_on | timestamp with time zone | | not null |
Indexes:
"account_group_by_id_aud_pkey" PRIMARY KEY, btree (group_id, include_uuid, added_on)


1
2
3
4
5
6
7
account_group_id
Sequence "public.account_group_id"
Type | Start | Minimum | Maximum | Increment | Cycles? | Cache
--------+-------+---------+---------------------+-----------+---------+-------
bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1


1
2
3
4
5
6
7
8
9
10
account_group_members
Table "public.account_group_members"
Column | Type | Collation | Nullable | Default
------------+---------+-----------+----------+---------
account_id | integer | | not null | 0
group_id | integer | | not null | 0
Indexes:
"account_group_members_pkey" PRIMARY KEY, btree (account_id, group_id) CLUSTER
"account_group_members_bygroup" btree (group_id)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
account_group_members_audit
Table "public.account_group_members_audit"
Column | Type | Collation | Nullable | Default
------------+--------------------------+-----------+----------+---------
added_by | integer | | not null | 0
removed_by | integer | | |
removed_on | timestamp with time zone | | |
account_id | integer | | not null | 0
group_id | integer | | not null | 0
added_on | timestamp with time zone | | not null |
Indexes:
"account_group_members_audit_pkey" PRIMARY KEY, btree (account_id, group_id, added_on)


1
2
3
4
5
6
7
8
9
account_group_names
Table "public.account_group_names"
Column | Type | Collation | Nullable | Default
----------+------------------------+-----------+----------+-----------------------
group_id | integer | | not null | 0
name | character varying(255) | | not null | ''::character varying
Indexes:
"account_group_names_pkey" PRIMARY KEY, btree (name)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
account_groups
Table "public.account_groups"
Column | Type | Collation | Nullable | Default
------------------+--------------------------+-----------+----------+-----------------------
name | character varying(255) | | not null | ''::character varying
description | text | | |
visible_to_all | character(1) | | not null | 'N'::bpchar
group_uuid | character varying(255) | | not null | ''::character varying
owner_group_uuid | character varying(255) | | not null | ''::character varying
created_on | timestamp with time zone | | |
group_id | integer | | not null | 0
Indexes:
"account_groups_pkey" PRIMARY KEY, btree (group_id)
Check constraints:
"account_groups_visible_to_all_check" CHECK (visible_to_all = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))


1
2
3
4
5
6
7
account_id
Sequence "public.account_id"
Type | Start | Minimum | Maximum | Increment | Cycles? | Cache
--------+---------+---------+---------------------+-----------+---------+-------
bigint | 1000000 | 1 | 9223372036854775807 | 1 | no | 1


1
2
3
4
5
6
7
change_id
Sequence "public.change_id"
Type | Start | Minimum | Maximum | Increment | Cycles? | Cache
--------+-------+---------+---------------------+-----------+---------+-------
bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
change_messages
Table "public.change_messages"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+-----------------------
author_id | integer | | |
written_on | timestamp with time zone | | not null |
message | text | | |
patchset_change_id | integer | | |
patchset_patch_set_id | integer | | |
tag | character varying(255) | | |
real_author | integer | | |
change_id | integer | | not null | 0
uuid | character varying(40) | | not null | ''::character varying
Indexes:
"change_messages_pkey" PRIMARY KEY, btree (change_id, uuid) CLUSTER
"change_messages_bypatchset" btree (patchset_change_id, patchset_patch_set_id)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
changes
Table "public.changes"
Column | Type | Collation | Nullable | Default
----------------------+--------------------------+-----------+----------+-----------------------
change_key | character varying(60) | | not null | ''::character varying
created_on | timestamp with time zone | | not null |
last_updated_on | timestamp with time zone | | not null |
owner_account_id | integer | | not null | 0
dest_project_name | character varying(255) | | not null | ''::character varying
dest_branch_name | character varying(255) | | not null | ''::character varying
status | character(1) | | not null | ' '::bpchar
current_patch_set_id | integer | | not null | 0
subject | character varying(255) | | not null | ''::character varying
topic | character varying(255) | | |
original_subject | character varying(255) | | |
submission_id | character varying(255) | | |
assignee | integer | | |
is_private | character(1) | | not null | 'N'::bpchar
work_in_progress | character(1) | | not null | 'N'::bpchar
review_started | character(1) | | not null | 'N'::bpchar
revert_of | integer | | |
note_db_state | text | | |
row_version | integer | | not null | 0
change_id | integer | | not null | 0
Indexes:
"changes_pkey" PRIMARY KEY, btree (change_id)
Check constraints:
"changes_is_private_check" CHECK (is_private = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
"changes_review_started_check" CHECK (review_started = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
"changes_work_in_progress_check" CHECK (work_in_progress = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 patch_comments
Table "public.patch_comments"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+-----------------------
line_nbr | integer | | not null | 0
author_id | integer | | not null | 0
written_on | timestamp with time zone | | not null |
status | character(1) | | not null | ' '::bpchar
side | smallint | | not null | 0
message | text | | |
parent_uuid | character varying(40) | | |
range_start_line | integer | | |
range_start_character | integer | | |
range_end_line | integer | | |
range_end_character | integer | | |
tag | character varying(255) | | |
real_author | integer | | |
unresolved | character(1) | | not null | 'N'::bpchar
change_id | integer | | not null | 0
patch_set_id | integer | | not null | 0
file_name | character varying(255) | | not null | ''::character varying
uuid | character varying(40) | | not null | ''::character varying
Indexes:
"patch_comments_pkey" PRIMARY KEY, btree (change_id, patch_set_id, file_name, uuid) CLUSTER
"patch_comment_drafts" btree (author_id) WHERE status = 'd'::bpchar
Check constraints:
"patch_comments_unresolved_check" CHECK (unresolved = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
patch_set_approvals
Table "public.patch_set_approvals"
Column | Type | Collation | Nullable | Default
-----------------+--------------------------+-----------+----------+-----------------------
value | smallint | | not null | 0
granted | timestamp with time zone | | not null |
tag | character varying(255) | | |
real_account_id | integer | | |
post_submit | character(1) | | not null | 'N'::bpchar
change_id | integer | | not null | 0
patch_set_id | integer | | not null | 0
account_id | integer | | not null | 0
category_id | character varying(255) | | not null | ''::character varying
Indexes:
"patch_set_approvals_pkey" PRIMARY KEY, btree (change_id, patch_set_id, account_id, category_id) CLUSTER
Check constraints:
"patch_set_approvals_post_submit_check" CHECK (post_submit = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
patch_sets
Table "public.patch_sets"
Column | Type | Collation | Nullable | Default
---------------------+--------------------------+-----------+----------+---------
revision | character varying(40) | | |
uploader_account_id | integer | | not null | 0
created_on | timestamp with time zone | | not null |
groups | text | | |
push_certificate | text | | |
description | text | | |
change_id | integer | | not null | 0
patch_set_id | integer | | not null | 0
Indexes:
"patch_sets_pkey" PRIMARY KEY, btree (change_id, patch_set_id) CLUSTER
"patch_sets_byrevision" btree (revision)


1
2
3
4
5
6
7
8
9
10

schema_version
Table "public.schema_version"
Column | Type | Collation | Nullable | Default
-------------+----------------------+-----------+----------+-----------------------
version_nbr | integer | | not null | 0
singleton | character varying(1) | | not null | ''::character varying
Indexes:
"schema_version_pkey" PRIMARY KEY, btree (singleton)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
system_config
Table "public.system_config"
Column | Type | Collation | Nullable | Default
----------------------------+------------------------+-----------+----------+-----------------------
register_email_private_key | character varying(36) | | |
site_path | text | | |
admin_group_id | integer | | |
anonymous_group_id | integer | | |
registered_group_id | integer | | |
wild_project_name | character varying(255) | | |
batch_users_group_id | integer | | |
owner_group_id | integer | | |
admin_group_uuid | character varying(255) | | |
batch_users_group_uuid | character varying(255) | | |
singleton | character varying(1) | | not null | ''::character varying
Indexes:
"system_config_pkey" PRIMARY KEY, btree (singleton)


2.12.x and 2.15.x

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2.12.x and 2.15.x

2.12.x 2.15.x
List of relations List of relations
Schema | Name | Type | Owner Schema | Name | Type | Owner
--------+-----------------------------+----------+-------- --------+-----------------------------+----------+--------
public | account_external_ids | table | gerrit
public | account_group_by_id | table | gerrit public | account_group_by_id | table | gerrit
public | account_group_by_id_aud | table | gerrit public | account_group_by_id_aud | table | gerrit
public | account_group_id | sequence | gerrit public | account_group_id | sequence | gerrit
public | account_group_members | table | gerrit public | account_group_members | table | gerrit
public | account_group_members_audit | table | gerrit public | account_group_members_audit | table | gerrit
public | account_group_names | table | gerrit public | account_group_names | table | gerrit
public | account_groups | table | gerrit public | account_groups | table | gerrit
public | account_id | sequence | gerrit public | account_id | sequence | gerrit
public | account_patch_reviews | table | gerrit
public | account_project_watches | table | gerrit
public | account_ssh_keys | table | gerrit
public | accounts | table | gerrit
public | change_id | sequence | gerrit public | change_id | sequence | gerrit
public | change_message_id | sequence | gerrit
public | change_messages | table | gerrit public | change_messages | table | gerrit
public | changes | table | gerrit public | changes | table | gerrit
public | patch_comments | table | gerrit public | patch_comments | table | gerrit
public | patch_set_approvals | table | gerrit public | patch_set_approvals | table | gerrit
public | patch_sets | table | gerrit public | patch_sets | table | gerrit
public | schema_version | table | gerrit public | schema_version | table | gerrit
public | starred_changes | table | gerrit
public | submodule_subscriptions | table | gerrit
public | system_config | table | gerrit public | system_config | table | gerrit
(24 rows) (16 rows)

List of relations List of relations
Schema | Name | Type | Owner Schema | Name | Type | Owner
--------+-------------------+----------+-------- --------+-------------------+----------+--------
public | account_group_id | sequence | gerrit public | account_group_id | sequence | gerrit
public | account_id | sequence | gerrit public | account_id | sequence | gerrit
public | change_id | sequence | gerrit public | change_id | sequence | gerrit
public | change_message_id | sequence | gerrit
(4 rows) (3 rows)

List of relations List of relations
Schema | Name | Type | Owner Schema | Name | Type | Owner
--------+-----------------------------+-------+-------- --------+-----------------------------+-------+--------
public | account_external_ids | table | gerrit
public | account_group_by_id | table | gerrit public | account_group_by_id | table | gerrit
public | account_group_by_id_aud | table | gerrit public | account_group_by_id_aud | table | gerrit
public | account_group_members | table | gerrit public | account_group_members | table | gerrit
public | account_group_members_audit | table | gerrit public | account_group_members_audit | table | gerrit
public | account_group_names | table | gerrit public | account_group_names | table | gerrit
public | account_groups | table | gerrit public | account_groups | table | gerrit
public | account_patch_reviews | table | gerrit
public | account_project_watches | table | gerrit
public | account_ssh_keys | table | gerrit
public | accounts | table | gerrit
public | change_messages | table | gerrit public | change_messages | table | gerrit
public | changes | table | gerrit public | changes | table | gerrit
public | patch_comments | table | gerrit public | patch_comments | table | gerrit
public | patch_set_approvals | table | gerrit public | patch_set_approvals | table | gerrit
public | patch_sets | table | gerrit public | patch_sets | table | gerrit
public | schema_version | table | gerrit public | schema_version | table | gerrit
public | starred_changes | table | gerrit
public | submodule_subscriptions | table | gerrit
public | system_config | table | gerrit public | system_config | table | gerrit
(20 rows) (13 rows)