You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/using-gitbase/schema.md
+81-81
Original file line number
Diff line number
Diff line change
@@ -38,33 +38,33 @@ This table will return all the [remotes](https://git-scm.com/book/en/v2/Git-Basi
38
38
39
39
### refs
40
40
```sql
41
-
+---------------+------+
42
-
| name | type |
43
-
+---------------+------+
44
-
| repository_id | TEXT |
45
-
| ref_name | TEXT |
46
-
| commit_hash | TEXT |
47
-
+---------------+------+
41
+
+---------------+-------------+
42
+
| name | type |
43
+
+---------------+-------------+
44
+
| repository_id | TEXT|
45
+
| ref_name | TEXT|
46
+
| commit_hash | VARCHAR(40) |
47
+
+---------------+-------------+
48
48
```
49
49
This table contains all hash [git references](https://git-scm.com/book/en/v2/Git-Internals-Git-References) and the symbolic reference `HEAD` from all the repositories.
50
50
51
51
### commits
52
52
```sql
53
-
+---------------------+-----------+
54
-
| name | type |
55
-
+---------------------+-----------+
56
-
| repository_id | TEXT |
57
-
| commit_hash | TEXT |
58
-
| commit_author_name | TEXT |
59
-
| commit_author_email | TEXT |
60
-
| commit_author_when | TIMESTAMP |
61
-
| committer_name | TEXT |
62
-
| committer_email | TEXT |
63
-
| committer_when | TIMESTAMP |
64
-
| commit_message | TEXT |
65
-
| tree_hash | TEXT |
66
-
| commit_parents | JSON |
67
-
+---------------------+-----------+
53
+
+---------------------+--------------+
54
+
| name | type |
55
+
+---------------------+--------------+
56
+
| repository_id | TEXT|
57
+
| commit_hash | VARCHAR(40) |
58
+
| commit_author_name | TEXT|
59
+
| commit_author_email | VARCHAR(254) |
60
+
| commit_author_when | TIMESTAMP|
61
+
| committer_name | TEXT|
62
+
| committer_email | VARCHAR(254) |
63
+
| committer_when | TIMESTAMP|
64
+
| commit_message | TEXT|
65
+
| tree_hash | TEXT|
66
+
| commit_parents | JSON |
67
+
+---------------------+--------------+
68
68
```
69
69
70
70
Commits contains all the [commits](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects#_git_commit_objects) from all the references from all the repositories, not duplicated by repository. Note that you can have the same commit in several repositories. In that case the commit will appear two times on the table, one per repository.
@@ -73,14 +73,14 @@ Commits contains all the [commits](https://git-scm.com/book/en/v2/Git-Internals-
73
73
74
74
### blobs
75
75
```sql
76
-
+---------------+-------+
77
-
| name | type |
78
-
+---------------+-------+
79
-
| repository_id | TEXT |
80
-
| blob_hash | TEXT |
81
-
| blob_size | INT64 |
82
-
| blob_content | BLOB |
83
-
+---------------+-------+
76
+
+---------------+--------------+
77
+
| name | type |
78
+
+---------------+--------------+
79
+
| repository_id | TEXT|
80
+
| blob_hash | VARCHAR(40) |
81
+
| blob_size | INT64 |
82
+
| blob_content | BLOB |
83
+
+---------------+--------------+
84
84
```
85
85
86
86
This table exposes blob objects, that are the content without path from files.
@@ -89,33 +89,33 @@ This table exposes blob objects, that are the content without path from files.
89
89
90
90
### tree_entries
91
91
```sql
92
-
+-----------------+------+
93
-
| name | type |
94
-
+-----------------+------+
95
-
| repository_id | TEXT |
96
-
| tree_entry_name | TEXT |
97
-
| blob_hash | TEXT |
98
-
| tree_hash | TEXT |
99
-
| tree_entry_mode | TEXT |
100
-
+-----------------+------+
92
+
+-----------------+-------------+
93
+
| name | type |
94
+
+-----------------+-------------+
95
+
| repository_id | TEXT|
96
+
| tree_entry_name | TEXT|
97
+
| blob_hash | VARCHAR(40) |
98
+
| tree_hash | VARCHAR(40) |
99
+
| tree_entry_mode | VARCHAR(16) |
100
+
+-----------------+-------------+
101
101
```
102
102
103
103
`tree_entries` table contains all the objects from all the repositories that are [tree objects](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects#_git_commit_objects).
104
104
105
105
106
106
### files
107
107
```sql
108
-
+-----------------+-------+
109
-
| name | type |
110
-
+-----------------+-------+
111
-
| repository_id | TEXT |
112
-
| file_path | TEXT |
113
-
| blob_hash | TEXT |
114
-
| tree_hash | TEXT |
115
-
| tree_entry_mode | TEXT |
116
-
| blob_content | BLOB |
117
-
| blob_size | INT64 |
118
-
+-----------------+-------+
108
+
+-----------------+--------------+
109
+
| name | type |
110
+
+-----------------+--------------+
111
+
| repository_id | TEXT|
112
+
| file_path | TEXT|
113
+
| blob_hash | VARCHAR(40) |
114
+
| tree_hash | VARCHAR(40) |
115
+
| tree_entry_mode | VARCHAR(16) |
116
+
| blob_content | BLOB |
117
+
| blob_size | INT64 |
118
+
+-----------------+--------------+
119
119
```
120
120
121
121
`files` is an utility table mixing `tree_entries` and `blobs` to create files. It includes the file path.
@@ -126,55 +126,55 @@ Queries to this table are expensive and they should be done carefully (applying
126
126
127
127
### commit_blobs
128
128
```sql
129
-
+---------------+------+
130
-
| name | type |
131
-
+---------------+------+
132
-
| repository_id | TEXT |
133
-
| commit_hash | TEXT |
134
-
| blob_hash | TEXT |
135
-
+---------------+------+
129
+
+---------------+-------------+
130
+
| name | type |
131
+
+---------------+-------------+
132
+
| repository_id | TEXT|
133
+
| commit_hash | VARCHAR(40) |
134
+
| blob_hash | VARCHAR(40) |
135
+
+---------------+-------------+
136
136
```
137
137
138
138
This table represents the relation between commits and blobs. With this table you can obtain all the blobs contained on a commit object.
139
139
140
140
### commit_trees
141
141
```sql
142
-
+---------------+------+
143
-
| name | type |
144
-
+---------------+------+
145
-
| repository_id | TEXT |
146
-
| commit_hash | TEXT |
147
-
| tree_hash | TEXT |
148
-
+---------------+------+
142
+
+---------------+-------------+
143
+
| name | type |
144
+
+---------------+-------------+
145
+
| repository_id | TEXT|
146
+
| commit_hash | VARCHAR(40) |
147
+
| tree_hash | VARCHAR(40) |
148
+
+---------------+-------------+
149
149
```
150
150
151
151
This table represents the relation between commits and trees. With this table you can obtain all the tree entries contained on a commit object.
152
152
153
153
### commit_files
154
154
```sql
155
-
+---------------+------+
156
-
| name | type |
157
-
+---------------+------+
158
-
| repository_id | TEXT |
159
-
| commit_hash | TEXT |
160
-
| file_path | TEXT |
161
-
| blob_hash | TEXT |
162
-
| tree_hash | TEXT |
163
-
+---------------+------+
155
+
+----------------------+------+
156
+
| name | type |
157
+
+----------------------+------+
158
+
| repository_id | TEXT|
159
+
| commit_hash | VARCHAR(40) |
160
+
| file_path | TEXT|
161
+
| blob_hash | VARCHAR(40) |
162
+
| tree_hash | VARCHAR(40) |
163
+
+---------------+-------------+
164
164
```
165
165
166
166
This table represents the relation between commits and [files](#files). Using this table, you can obtain all the files related to a certain commit object.
167
167
168
168
### ref_commits
169
169
```sql
170
-
+---------------+-------+
171
-
| name | type |
172
-
+---------------+-------+
173
-
| repository_id | TEXT |
174
-
| commit_hash | TEXT |
175
-
| ref_name | TEXT |
176
-
| history_index | INT64 |
177
-
+---------------+-------+
170
+
+---------------+--------------+
171
+
| name | type |
172
+
+---------------+--------------+
173
+
| repository_id | TEXT|
174
+
| commit_hash | VARCHAR(40) |
175
+
| ref_name | TEXT|
176
+
| history_index | INT64 |
177
+
+---------------+--------------+
178
178
```
179
179
180
180
This table allow us to get the commit history from a specific reference name. `history_index` column represents the position of the commit from a specific reference.
0 commit comments