Add commit_uri and commit_hash to Entry

This commit is contained in:
Mustafa Gezen 2023-08-28 16:57:09 +02:00
parent 4430fb562d
commit 3a417acff0
Signed by: mustafa
GPG Key ID: DCDF010D946438C1
3 changed files with 15 additions and 2 deletions

View File

@ -27,13 +27,15 @@ type Entry struct {
Name string `db:"name"`
EntryID string `db:"entry_id"`
CreateTime time.Time `db:"create_time"`
CreateTime time.Time `db:"create_time" pika:"omitempty"`
OSRelease string `db:"os_release"`
Sha256Sum string `db:"sha256_sum"`
RepositoryName string `db:"repository_name"`
WorkerID sql.NullString `db:"worker_id"`
BatchName sql.NullString `db:"batch_name"`
UserEmail sql.NullString `db:"user_email"`
CommitURI string `db:"commit_uri"`
CommitHash string `db:"commit_hash"`
}
func (e *Entry) GetID() string {
@ -47,8 +49,11 @@ func (e *Entry) ToPB() *mothershippb.Entry {
CreateTime: timestamppb.New(e.CreateTime),
OsRelease: e.OSRelease,
Sha256Sum: e.Sha256Sum,
Repository: e.RepositoryName,
WorkerId: base.SqlNullString(e.WorkerID),
Batch: base.SqlNullString(e.BatchName),
UserEmail: base.SqlNullString(e.UserEmail),
CommitUri: e.CommitURI,
CommitHash: e.CommitHash,
}
}

View File

@ -31,7 +31,9 @@ CREATE TABLE entries
repository_name VARCHAR(255) NOT NULL,
worker_id VARCHAR(255) REFERENCES workers (worker_id),
batch_name VARCHAR(255),
user_email TEXT
user_email TEXT,
commit_uri TEXT NOT NULL,
commit_hash TEXT NOT NULL
);
CREATE TABLE batches

View File

@ -70,4 +70,10 @@ message Entry {
// If this field is not set, the package was archived by a
// worker instead of a user.
google.protobuf.StringValue user_email = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
// URI to view commit
string commit_uri = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
// Commit hash of the resulting import
string commit_hash = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
}