-
Notifications
You must be signed in to change notification settings - Fork 75
/
models.go
84 lines (74 loc) · 2.64 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (c) 2020 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package cockroachdb
import (
_ "github.com/jinzhu/gorm/dialects/postgres"
)
// Version describes the version of a record or plugin that the database is
// currently using.
type Version struct {
ID string `gorm:"primary_key"` // Primary key
Version string `gorm:"not null"` // Version
Timestamp int64 `gorm:"not null"` // UNIX timestamp of record creation
}
// TableName returns the table name of the versions table.
func (Version) TableName() string {
return tableNameVersions
}
// PullRequest table has all of the information for a given PullRequest,
// this also includes its commits and reviews.
type PullRequest struct {
ID string `gorm:"primary_key"`
Repo string `gorm:"not null"`
Organization string `gorm:"not null"`
URL string `gorm:"not null"`
Number int `gorm:"not null"`
Author string `gorm:"not null"`
UpdatedAt int64 `gorm:"not null"`
ClosedAt int64 `gorm:"not null"`
MergedAt int64 `gorm:"not null"`
Merged bool `gorm:"not null"`
State string `gorm:"not null"`
Additions int `gorm:"not null"`
Deletions int `gorm:"not null"`
MergedBy string `gorm:"not null"`
}
// TableName returns the table name of the pull requests table.
func (PullRequest) TableName() string {
return tableNamePullRequest
}
// PullRequestReview contains all of the information about reviews of a given
// pull request.
type PullRequestReview struct {
PullRequestURL string `gorm:"not null"`
ID int64 `gorm:"primary_key"`
Author string `gorm:"not null"`
State string `gorm:"not null"`
SubmittedAt int64 `gorm:"not null"`
CommitID string `gorm:"not null"`
Repo string `gorm:"not null"`
Number int `gorm:"not null"`
}
// TableName returns the table name of the pull requests review table.
func (PullRequestReview) TableName() string {
return tableNameReviews
}
type Commit struct {
SHA string `gorm:"primary_key"`
Repo string `gorm:"repo"`
Organization string `gorm:"organization"`
Date int64 `gorm:"not null"`
Author string `gorm:"not null"`
Committer string `gorm:"not null"`
Message string `gorm:"not null"`
URL string `gorm:"not null"`
ParentSHA string `gorm:"not null"`
ParentURL string `gorm:"not null"`
Additions int `gorm:"not null"`
Deletions int `gorm:"not null"`
}
// TableName returns the table name of the commits table.
func (Commit) TableName() string {
return tableNameCommits
}