Skip to content

Commit

Permalink
Switch some TEXT types to VARCHAR
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <[email protected]>
  • Loading branch information
Juanjo Alvarez committed Jul 4, 2019
1 parent 8954e18 commit 469e97f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type blobsTable struct {
// BlobsSchema is the schema for the blobs table.
var BlobsSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: BlobsTableName},
{Name: "blob_hash", Type: sql.Text, Nullable: false, Source: BlobsTableName},
{Name: "blob_hash", Type: sql.VarChar(40), Nullable: false, Source: BlobsTableName},
{Name: "blob_size", Type: sql.Int64, Nullable: false, Source: BlobsTableName},
{Name: "blob_content", Type: sql.Blob, Nullable: false, Source: BlobsTableName},
}
Expand Down
4 changes: 2 additions & 2 deletions commit_blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type commitBlobsTable struct {
// CommitBlobsSchema is the schema for the commit blobs table.
var CommitBlobsSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Source: CommitBlobsTableName},
{Name: "commit_hash", Type: sql.Text, Source: CommitBlobsTableName},
{Name: "blob_hash", Type: sql.Text, Source: CommitBlobsTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitBlobsTableName},
{Name: "blob_hash", Type: sql.VarChar(40), Source: CommitBlobsTableName},
}

var _ Table = (*commitBlobsTable)(nil)
Expand Down
6 changes: 3 additions & 3 deletions commit_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type commitFilesTable struct {
// CommitFilesSchema is the schema for the commit trees table.
var CommitFilesSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Source: CommitFilesTableName},
{Name: "commit_hash", Type: sql.Text, Source: CommitFilesTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
{Name: "file_path", Type: sql.Text, Source: CommitFilesTableName},
{Name: "blob_hash", Type: sql.Text, Source: CommitFilesTableName},
{Name: "tree_hash", Type: sql.Text, Source: CommitFilesTableName},
{Name: "blob_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
{Name: "tree_hash", Type: sql.VarChar(40), Source: CommitFilesTableName},
}

func newCommitFilesTable(pool *RepositoryPool) Indexable {
Expand Down
4 changes: 2 additions & 2 deletions commit_trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type commitTreesTable struct {
// CommitTreesSchema is the schema for the commit trees table.
var CommitTreesSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Source: CommitTreesTableName},
{Name: "commit_hash", Type: sql.Text, Source: CommitTreesTableName},
{Name: "tree_hash", Type: sql.Text, Source: CommitTreesTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Source: CommitTreesTableName},
{Name: "tree_hash", Type: sql.VarChar(40), Source: CommitTreesTableName},
}

func newCommitTreesTable(pool *RepositoryPool) Indexable {
Expand Down
10 changes: 5 additions & 5 deletions commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ type commitsTable struct {
// CommitsSchema is the schema for the commits table.
var CommitsSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "commit_hash", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Nullable: false, Source: CommitsTableName},
{Name: "commit_author_name", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "commit_author_email", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "commit_author_email", Type: sql.VarChar(254), Nullable: false, Source: CommitsTableName},
{Name: "commit_author_when", Type: sql.Timestamp, Nullable: false, Source: CommitsTableName},
{Name: "committer_name", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "committer_email", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "committer_email", Type: sql.VarChar(254), Nullable: false, Source: CommitsTableName},
{Name: "committer_when", Type: sql.Timestamp, Nullable: false, Source: CommitsTableName},
{Name: "commit_message", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "tree_hash", Type: sql.Text, Nullable: false, Source: CommitsTableName},
{Name: "commit_parents", Type: sql.Array(sql.Text), Nullable: false, Source: CommitsTableName},
{Name: "tree_hash", Type: sql.VarChar(40), Nullable: false, Source: CommitsTableName},
{Name: "commit_parents", Type: sql.Array(sql.VarChar(40)), Nullable: false, Source: CommitsTableName},
}

func newCommitsTable(pool *RepositoryPool) *commitsTable {
Expand Down
6 changes: 3 additions & 3 deletions files.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ type filesTable struct {
var FilesSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Source: "files"},
{Name: "file_path", Type: sql.Text, Source: "files"},
{Name: "blob_hash", Type: sql.Text, Source: "files"},
{Name: "tree_hash", Type: sql.Text, Source: "files"},
{Name: "tree_entry_mode", Type: sql.Text, Source: "files"},
{Name: "blob_hash", Type: sql.VarChar(40), Source: "files"},
{Name: "tree_hash", Type: sql.VarChar(40), Source: "files"},
{Name: "tree_entry_mode", Type: sql.VarChar(16), Source: "files"},
{Name: "blob_content", Type: sql.Blob, Source: "files"},
{Name: "blob_size", Type: sql.Int64, Source: "files"},
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/src-d/gitbase

go 1.12

replace github.com/src-d/go-mysql-server => /home/juanjux/sourced/go-mysql-server.v0

require (
github.com/bblfsh/go-client/v4 v4.1.0
github.com/bblfsh/sdk/v3 v3.1.0
Expand Down
2 changes: 1 addition & 1 deletion ref_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type refCommitsTable struct {
// RefCommitsSchema is the schema for the ref commits table.
var RefCommitsSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Source: RefCommitsTableName},
{Name: "commit_hash", Type: sql.Text, Source: RefCommitsTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Source: RefCommitsTableName},
{Name: "ref_name", Type: sql.Text, Source: RefCommitsTableName},
{Name: "history_index", Type: sql.Int64, Source: RefCommitsTableName},
}
Expand Down
2 changes: 1 addition & 1 deletion references.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type referencesTable struct {
var RefsSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
{Name: "ref_name", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
{Name: "commit_hash", Type: sql.Text, Nullable: false, Source: ReferencesTableName},
{Name: "commit_hash", Type: sql.VarChar(40), Nullable: false, Source: ReferencesTableName},
}

func newReferencesTable(pool *RepositoryPool) *referencesTable {
Expand Down
6 changes: 3 additions & 3 deletions tree_entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type treeEntriesTable struct {
var TreeEntriesSchema = sql.Schema{
{Name: "repository_id", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
{Name: "tree_entry_name", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
{Name: "blob_hash", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
{Name: "tree_hash", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
{Name: "tree_entry_mode", Type: sql.Text, Nullable: false, Source: TreeEntriesTableName},
{Name: "blob_hash", Type: sql.VarChar(40), Nullable: false, Source: TreeEntriesTableName},
{Name: "tree_hash", Type: sql.VarChar(40), Nullable: false, Source: TreeEntriesTableName},
{Name: "tree_entry_mode", Type: sql.VarChar(16), Nullable: false, Source: TreeEntriesTableName},
}

func newTreeEntriesTable(pool *RepositoryPool) *treeEntriesTable {
Expand Down

0 comments on commit 469e97f

Please sign in to comment.