Skip to content

Commit 24c3e7c

Browse files
author
Juanjo Alvarez
committed
Update schema.md and png files
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 469e97f commit 24c3e7c

File tree

6 files changed

+86
-137
lines changed

6 files changed

+86
-137
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Errors now report the repository causing the error, if possible.
1717
- Now non rooted siva files support old siva rooted repositories.
18+
- Switch some types of known or maximum length (mostly hashes and emails)
19+
to VarChar with a size.
1820
- Traces now have a root span.
1921

2022
### Fixed

docs/assets/gitbase-schema.png

22.8 KB
Loading

docs/assets/gitbase_model.mwb

531 Bytes
Binary file not shown.

docs/using-gitbase/schema.md

+81-81
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,33 @@ This table will return all the [remotes](https://git-scm.com/book/en/v2/Git-Basi
3838

3939
### refs
4040
``` 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+
+---------------+-------------+
4848
```
4949
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.
5050

5151
### commits
5252
``` 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+
+---------------------+--------------+
6868
```
6969

7070
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-
7373
7474
### blobs
7575
```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+
+---------------+--------------+
8484
```
8585

8686
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.
8989
9090
### tree_entries
9191
```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+
+-----------------+-------------+
101101
```
102102

103103
`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).
104104

105105

106106
### files
107107
```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+
+-----------------+--------------+
119119
```
120120

121121
`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
126126

127127
### commit_blobs
128128
```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+
+---------------+-------------+
136136
```
137137

138138
This table represents the relation between commits and blobs. With this table you can obtain all the blobs contained on a commit object.
139139

140140
### commit_trees
141141
```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 | TEXT |
148+
+---------------+-------------+
149149
```
150150

151151
This table represents the relation between commits and trees. With this table you can obtain all the tree entries contained on a commit object.
152152

153153
### commit_files
154154
```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+
+---------------+-------------+
164164
```
165165

166166
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.
167167

168168
### ref_commits
169169
```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+
+---------------+--------------+
178178
```
179179

180180
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.

go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/src-d/gitbase
22

33
go 1.12
44

5-
replace github.com/src-d/go-mysql-server => /home/juanjux/sourced/go-mysql-server.v0
6-
75
require (
86
github.com/bblfsh/go-client/v4 v4.1.0
97
github.com/bblfsh/sdk/v3 v3.1.0
@@ -21,7 +19,7 @@ require (
2119
github.com/src-d/go-borges v0.0.0-20190628121335-da12a84d60fd
2220
github.com/src-d/go-git v4.7.0+incompatible
2321
github.com/src-d/go-git-fixtures v3.5.1-0.20190605154830-57f3972b0248+incompatible
24-
github.com/src-d/go-mysql-server v0.4.1-0.20190703140603-bbae51955887
22+
github.com/src-d/go-mysql-server v0.4.1-0.20190704102044-409efb9ac21c
2523
github.com/stretchr/testify v1.3.0
2624
github.com/uber-go/atomic v1.4.0 // indirect
2725
github.com/uber/jaeger-client-go v2.16.0+incompatible

0 commit comments

Comments
 (0)