Skip to content

Commit 66a4d89

Browse files
author
Juanjo Alvarez
committed
Switch some TEXT types to VARCHAR
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 2fb1fcd commit 66a4d89

File tree

10 files changed

+23
-21
lines changed

10 files changed

+23
-21
lines changed

blobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type blobsTable struct {
3636
// BlobsSchema is the schema for the blobs table.
3737
var BlobsSchema = sql.Schema{
3838
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: BlobsTableName},
39-
{Name: "blob_hash", Type: sql.Text, Nullable: false, Source: BlobsTableName},
39+
{Name: "blob_hash", Type: sql.VarChar(40), Nullable: false, Source: BlobsTableName},
4040
{Name: "blob_size", Type: sql.Int64, Nullable: false, Source: BlobsTableName},
4141
{Name: "blob_content", Type: sql.Blob, Nullable: false, Source: BlobsTableName},
4242
}

commit_blobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type commitBlobsTable struct {
1919
// CommitBlobsSchema is the schema for the commit blobs table.
2020
var CommitBlobsSchema = sql.Schema{
2121
{Name: "repository_id", Type: sql.Text, Source: CommitBlobsTableName},
22-
{Name: "commit_hash", Type: sql.Text, Source: CommitBlobsTableName},
23-
{Name: "blob_hash", Type: sql.Text, Source: CommitBlobsTableName},
22+
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitBlobsTableName},
23+
{Name: "blob_hash", Type: sql.VarChar(40), Source: CommitBlobsTableName},
2424
}
2525

2626
var _ Table = (*commitBlobsTable)(nil)

commit_files.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ type commitFilesTable struct {
2424
// CommitFilesSchema is the schema for the commit trees table.
2525
var CommitFilesSchema = sql.Schema{
2626
{Name: "repository_id", Type: sql.Text, Source: CommitFilesTableName},
27-
{Name: "commit_hash", Type: sql.Text, Source: CommitFilesTableName},
27+
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
2828
{Name: "file_path", Type: sql.Text, Source: CommitFilesTableName},
29-
{Name: "blob_hash", Type: sql.Text, Source: CommitFilesTableName},
30-
{Name: "tree_hash", Type: sql.Text, Source: CommitFilesTableName},
29+
{Name: "blob_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
30+
{Name: "tree_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
3131
}
3232

3333
func newCommitFilesTable(pool *RepositoryPool) Indexable {

commit_trees.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type commitTreesTable struct {
2121
// CommitTreesSchema is the schema for the commit trees table.
2222
var CommitTreesSchema = sql.Schema{
2323
{Name: "repository_id", Type: sql.Text, Source: CommitTreesTableName},
24-
{Name: "commit_hash", Type: sql.Text, Source: CommitTreesTableName},
25-
{Name: "tree_hash", Type: sql.Text, Source: CommitTreesTableName},
24+
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitTreesTableName},
25+
{Name: "tree_hash", Type: sql.VarChar(40), Source: CommitTreesTableName},
2626
}
2727

2828
func newCommitTreesTable(pool *RepositoryPool) Indexable {

commits.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ type commitsTable struct {
2020
// CommitsSchema is the schema for the commits table.
2121
var CommitsSchema = sql.Schema{
2222
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: CommitsTableName},
23-
{Name: "commit_hash", Type: sql.Text, Nullable: false, Source: CommitsTableName},
23+
{Name: "commit_hash", Type: sql.VarChar(40), Nullable: false, Source: CommitsTableName},
2424
{Name: "commit_author_name", Type: sql.Text, Nullable: false, Source: CommitsTableName},
25-
{Name: "commit_author_email", Type: sql.Text, Nullable: false, Source: CommitsTableName},
25+
{Name: "commit_author_email", Type: sql.VarChar(254), Nullable: false, Source: CommitsTableName},
2626
{Name: "commit_author_when", Type: sql.Timestamp, Nullable: false, Source: CommitsTableName},
2727
{Name: "committer_name", Type: sql.Text, Nullable: false, Source: CommitsTableName},
28-
{Name: "committer_email", Type: sql.Text, Nullable: false, Source: CommitsTableName},
28+
{Name: "committer_email", Type: sql.VarChar(254), Nullable: false, Source: CommitsTableName},
2929
{Name: "committer_when", Type: sql.Timestamp, Nullable: false, Source: CommitsTableName},
3030
{Name: "commit_message", Type: sql.Text, Nullable: false, Source: CommitsTableName},
31-
{Name: "tree_hash", Type: sql.Text, Nullable: false, Source: CommitsTableName},
32-
{Name: "commit_parents", Type: sql.Array(sql.Text), Nullable: false, Source: CommitsTableName},
31+
{Name: "tree_hash", Type: sql.VarChar(40), Nullable: false, Source: CommitsTableName},
32+
{Name: "commit_parents", Type: sql.Array(sql.VarChar(40)), Nullable: false, Source: CommitsTableName},
3333
}
3434

3535
func newCommitsTable(pool *RepositoryPool) *commitsTable {

files.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ type filesTable struct {
2323
var FilesSchema = sql.Schema{
2424
{Name: "repository_id", Type: sql.Text, Source: "files"},
2525
{Name: "file_path", Type: sql.Text, Source: "files"},
26-
{Name: "blob_hash", Type: sql.Text, Source: "files"},
27-
{Name: "tree_hash", Type: sql.Text, Source: "files"},
28-
{Name: "tree_entry_mode", Type: sql.Text, Source: "files"},
26+
{Name: "blob_hash", Type: sql.VarChar(40), Source: "files"},
27+
{Name: "tree_hash", Type: sql.VarChar(40), Source: "files"},
28+
{Name: "tree_entry_mode", Type: sql.VarChar(16), Source: "files"},
2929
{Name: "blob_content", Type: sql.Blob, Source: "files"},
3030
{Name: "blob_size", Type: sql.Int64, Source: "files"},
3131
}

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ 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+
57
require (
68
github.com/bblfsh/go-client/v4 v4.1.0
79
github.com/bblfsh/sdk/v3 v3.1.0

ref_commits.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type refCommitsTable struct {
2222
// RefCommitsSchema is the schema for the ref commits table.
2323
var RefCommitsSchema = sql.Schema{
2424
{Name: "repository_id", Type: sql.Text, Source: RefCommitsTableName},
25-
{Name: "commit_hash", Type: sql.Text, Source: RefCommitsTableName},
25+
{Name: "commit_hash", Type: sql.VarChar(40), Source: RefCommitsTableName},
2626
{Name: "ref_name", Type: sql.Text, Source: RefCommitsTableName},
2727
{Name: "history_index", Type: sql.Int64, Source: RefCommitsTableName},
2828
}

references.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type referencesTable struct {
2323
var RefsSchema = sql.Schema{
2424
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
2525
{Name: "ref_name", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
26-
{Name: "commit_hash", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
26+
{Name: "commit_hash", Type: sql.VarChar(40), Nullable: false, Source: ReferencesTableName},
2727
}
2828

2929
func newReferencesTable(pool *RepositoryPool) *referencesTable {

tree_entries.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ type treeEntriesTable struct {
2222
var TreeEntriesSchema = sql.Schema{
2323
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
2424
{Name: "tree_entry_name", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
25-
{Name: "blob_hash", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
26-
{Name: "tree_hash", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
27-
{Name: "tree_entry_mode", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
25+
{Name: "blob_hash", Type: sql.VarChar(40), Nullable: false, Source: TreeEntriesTableName},
26+
{Name: "tree_hash", Type: sql.VarChar(40), Nullable: false, Source: TreeEntriesTableName},
27+
{Name: "tree_entry_mode", Type: sql.VarChar(16), Nullable: false, Source: TreeEntriesTableName},
2828
}
2929

3030
func newTreeEntriesTable(pool *RepositoryPool) *treeEntriesTable {

0 commit comments

Comments
 (0)