mirror of https://github.com/gogs/gogs.git
models: remove redundant tags for primary keys
parent
1755025e7f
commit
ce6e8ed8fe
|
@ -53,7 +53,7 @@ func ParseAccessMode(permission string) AccessMode {
|
||||||
// that is not in this table is the real owner of a repository. In case of an organization
|
// that is not in this table is the real owner of a repository. In case of an organization
|
||||||
// repository, the members of the owners team are in this table.
|
// repository, the members of the owners team are in this table.
|
||||||
type Access struct {
|
type Access struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UserID int64 `xorm:"UNIQUE(s)"`
|
UserID int64 `xorm:"UNIQUE(s)"`
|
||||||
RepoID int64 `xorm:"UNIQUE(s)"`
|
RepoID int64 `xorm:"UNIQUE(s)"`
|
||||||
Mode AccessMode
|
Mode AccessMode
|
||||||
|
|
|
@ -15,8 +15,8 @@ import (
|
||||||
"github.com/go-xorm/xorm"
|
"github.com/go-xorm/xorm"
|
||||||
log "gopkg.in/clog.v1"
|
log "gopkg.in/clog.v1"
|
||||||
|
|
||||||
"github.com/gogits/gogs/pkg/tool"
|
|
||||||
"github.com/gogits/gogs/pkg/setting"
|
"github.com/gogits/gogs/pkg/setting"
|
||||||
|
"github.com/gogits/gogs/pkg/tool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NoticeType int
|
type NoticeType int
|
||||||
|
@ -27,7 +27,7 @@ const (
|
||||||
|
|
||||||
// Notice represents a system notice for admin.
|
// Notice represents a system notice for admin.
|
||||||
type Notice struct {
|
type Notice struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
Type NoticeType
|
Type NoticeType
|
||||||
Description string `xorm:"TEXT"`
|
Description string `xorm:"TEXT"`
|
||||||
Created time.Time `xorm:"-"`
|
Created time.Time `xorm:"-"`
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
// Attachment represent a attachment of issue/comment/release.
|
// Attachment represent a attachment of issue/comment/release.
|
||||||
type Attachment struct {
|
type Attachment struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UUID string `xorm:"uuid UNIQUE"`
|
UUID string `xorm:"uuid UNIQUE"`
|
||||||
IssueID int64 `xorm:"INDEX"`
|
IssueID int64 `xorm:"INDEX"`
|
||||||
CommentID int64
|
CommentID int64
|
||||||
|
|
|
@ -49,7 +49,7 @@ const (
|
||||||
|
|
||||||
// Comment represents a comment in commit and issue page.
|
// Comment represents a comment in commit and issue page.
|
||||||
type Comment struct {
|
type Comment struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
Type CommentType
|
Type CommentType
|
||||||
PosterID int64
|
PosterID int64
|
||||||
Poster *User `xorm:"-"`
|
Poster *User `xorm:"-"`
|
||||||
|
|
|
@ -16,8 +16,8 @@ import (
|
||||||
api "github.com/gogits/go-gogs-client"
|
api "github.com/gogits/go-gogs-client"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models/errors"
|
"github.com/gogits/gogs/models/errors"
|
||||||
"github.com/gogits/gogs/pkg/tool"
|
|
||||||
"github.com/gogits/gogs/pkg/setting"
|
"github.com/gogits/gogs/pkg/setting"
|
||||||
|
"github.com/gogits/gogs/pkg/tool"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,7 +26,7 @@ var (
|
||||||
|
|
||||||
// Issue represents an issue or pull request of repository.
|
// Issue represents an issue or pull request of repository.
|
||||||
type Issue struct {
|
type Issue struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64 `xorm:"INDEX UNIQUE(repo_index)"`
|
RepoID int64 `xorm:"INDEX UNIQUE(repo_index)"`
|
||||||
Repo *Repository `xorm:"-"`
|
Repo *Repository `xorm:"-"`
|
||||||
Index int64 `xorm:"UNIQUE(repo_index)"` // Index in one repository.
|
Index int64 `xorm:"UNIQUE(repo_index)"` // Index in one repository.
|
||||||
|
@ -1007,7 +1007,7 @@ func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
|
||||||
|
|
||||||
// IssueUser represents an issue-user relation.
|
// IssueUser represents an issue-user relation.
|
||||||
type IssueUser struct {
|
type IssueUser struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UID int64 `xorm:"INDEX"` // User ID.
|
UID int64 `xorm:"INDEX"` // User ID.
|
||||||
IssueID int64
|
IssueID int64
|
||||||
RepoID int64 `xorm:"INDEX"`
|
RepoID int64 `xorm:"INDEX"`
|
||||||
|
|
|
@ -54,7 +54,7 @@ func GetLabelTemplateFile(name string) ([][2]string, error) {
|
||||||
|
|
||||||
// Label represents a label of repository for issues.
|
// Label represents a label of repository for issues.
|
||||||
type Label struct {
|
type Label struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64 `xorm:"INDEX"`
|
RepoID int64 `xorm:"INDEX"`
|
||||||
Name string
|
Name string
|
||||||
Color string `xorm:"VARCHAR(7)"`
|
Color string `xorm:"VARCHAR(7)"`
|
||||||
|
@ -213,7 +213,7 @@ func DeleteLabel(repoID, labelID int64) error {
|
||||||
|
|
||||||
// IssueLabel represetns an issue-lable relation.
|
// IssueLabel represetns an issue-lable relation.
|
||||||
type IssueLabel struct {
|
type IssueLabel struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
IssueID int64 `xorm:"UNIQUE(s)"`
|
IssueID int64 `xorm:"UNIQUE(s)"`
|
||||||
LabelID int64 `xorm:"UNIQUE(s)"`
|
LabelID int64 `xorm:"UNIQUE(s)"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ func (cfg *PAMConfig) ToDB() ([]byte, error) {
|
||||||
|
|
||||||
// LoginSource represents an external way for authorizing users.
|
// LoginSource represents an external way for authorizing users.
|
||||||
type LoginSource struct {
|
type LoginSource struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
Type LoginType
|
Type LoginType
|
||||||
Name string `xorm:"UNIQUE"`
|
Name string `xorm:"UNIQUE"`
|
||||||
IsActived bool `xorm:"NOT NULL DEFAULT false"`
|
IsActived bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
|
@ -327,16 +327,16 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR
|
||||||
IsActive: true,
|
IsActive: true,
|
||||||
IsAdmin: isAdmin,
|
IsAdmin: isAdmin,
|
||||||
}
|
}
|
||||||
|
|
||||||
ok, err := IsUserExist(0, user.Name)
|
ok, err := IsUserExist(0, user.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return user, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
return user, UpdateUser(user)
|
return user, UpdateUser(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
return user, CreateUser(user)
|
return user, CreateUser(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
|
|
||||||
// Milestone represents a milestone of repository.
|
// Milestone represents a milestone of repository.
|
||||||
type Milestone struct {
|
type Milestone struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64 `xorm:"INDEX"`
|
RepoID int64 `xorm:"INDEX"`
|
||||||
Name string
|
Name string
|
||||||
Content string `xorm:"TEXT"`
|
Content string `xorm:"TEXT"`
|
||||||
|
|
|
@ -27,7 +27,7 @@ var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)
|
||||||
|
|
||||||
// Mirror represents mirror information of a repository.
|
// Mirror represents mirror information of a repository.
|
||||||
type Mirror struct {
|
type Mirror struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64
|
RepoID int64
|
||||||
Repo *Repository `xorm:"-"`
|
Repo *Repository `xorm:"-"`
|
||||||
Interval int // Hour.
|
Interval int // Hour.
|
||||||
|
|
|
@ -237,7 +237,7 @@ func DeleteOrganization(org *User) (err error) {
|
||||||
|
|
||||||
// OrgUser represents an organization-user relation.
|
// OrgUser represents an organization-user relation.
|
||||||
type OrgUser struct {
|
type OrgUser struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
Uid int64 `xorm:"INDEX UNIQUE(s)"`
|
Uid int64 `xorm:"INDEX UNIQUE(s)"`
|
||||||
OrgID int64 `xorm:"INDEX UNIQUE(s)"`
|
OrgID int64 `xorm:"INDEX UNIQUE(s)"`
|
||||||
IsPublic bool
|
IsPublic bool
|
||||||
|
|
|
@ -16,7 +16,7 @@ const OWNER_TEAM = "Owners"
|
||||||
|
|
||||||
// Team represents a organization team.
|
// Team represents a organization team.
|
||||||
type Team struct {
|
type Team struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
OrgID int64 `xorm:"INDEX"`
|
OrgID int64 `xorm:"INDEX"`
|
||||||
LowerName string
|
LowerName string
|
||||||
Name string
|
Name string
|
||||||
|
@ -406,7 +406,7 @@ func DeleteTeam(t *Team) error {
|
||||||
|
|
||||||
// TeamUser represents an team-user relation.
|
// TeamUser represents an team-user relation.
|
||||||
type TeamUser struct {
|
type TeamUser struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
OrgID int64 `xorm:"INDEX"`
|
OrgID int64 `xorm:"INDEX"`
|
||||||
TeamID int64 `xorm:"UNIQUE(s)"`
|
TeamID int64 `xorm:"UNIQUE(s)"`
|
||||||
UID int64 `xorm:"UNIQUE(s)"`
|
UID int64 `xorm:"UNIQUE(s)"`
|
||||||
|
|
|
@ -43,7 +43,7 @@ const (
|
||||||
|
|
||||||
// PullRequest represents relation between pull request and repositories.
|
// PullRequest represents relation between pull request and repositories.
|
||||||
type PullRequest struct {
|
type PullRequest struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
Type PullRequestType
|
Type PullRequestType
|
||||||
Status PullRequestStatus
|
Status PullRequestStatus
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
|
|
||||||
// Release represents a release of repository.
|
// Release represents a release of repository.
|
||||||
type Release struct {
|
type Release struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64
|
RepoID int64
|
||||||
Repo *Repository `xorm:"-"`
|
Repo *Repository `xorm:"-"`
|
||||||
PublisherID int64
|
PublisherID int64
|
||||||
|
|
|
@ -141,7 +141,7 @@ func NewRepoContext() {
|
||||||
|
|
||||||
// Repository contains information of a repository.
|
// Repository contains information of a repository.
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
OwnerID int64 `xorm:"UNIQUE(s)"`
|
OwnerID int64 `xorm:"UNIQUE(s)"`
|
||||||
Owner *User `xorm:"-"`
|
Owner *User `xorm:"-"`
|
||||||
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||||
|
@ -2055,7 +2055,7 @@ func (repos MirrorRepositoryList) LoadAttributes() error {
|
||||||
|
|
||||||
// Watch is connection request for receiving repository notification.
|
// Watch is connection request for receiving repository notification.
|
||||||
type Watch struct {
|
type Watch struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UserID int64 `xorm:"UNIQUE(watch)"`
|
UserID int64 `xorm:"UNIQUE(watch)"`
|
||||||
RepoID int64 `xorm:"UNIQUE(watch)"`
|
RepoID int64 `xorm:"UNIQUE(watch)"`
|
||||||
}
|
}
|
||||||
|
@ -2161,7 +2161,7 @@ func NotifyWatchers(act *Action) error {
|
||||||
// \/ \/
|
// \/ \/
|
||||||
|
|
||||||
type Star struct {
|
type Star struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UID int64 `xorm:"UNIQUE(s)"`
|
UID int64 `xorm:"UNIQUE(s)"`
|
||||||
RepoID int64 `xorm:"UNIQUE(s)"`
|
RepoID int64 `xorm:"UNIQUE(s)"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
// Collaboration represent the relation between an individual and a repository.
|
// Collaboration represent the relation between an individual and a repository.
|
||||||
type Collaboration struct {
|
type Collaboration struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||||
UserID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
UserID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||||
Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"`
|
Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"`
|
||||||
|
|
|
@ -307,7 +307,7 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
|
||||||
|
|
||||||
// Upload represent a uploaded file to a repo to be deleted when moved
|
// Upload represent a uploaded file to a repo to be deleted when moved
|
||||||
type Upload struct {
|
type Upload struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UUID string `xorm:"uuid UNIQUE"`
|
UUID string `xorm:"uuid UNIQUE"`
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ const (
|
||||||
|
|
||||||
// PublicKey represents a user or deploy SSH public key.
|
// PublicKey represents a user or deploy SSH public key.
|
||||||
type PublicKey struct {
|
type PublicKey struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
OwnerID int64 `xorm:"INDEX NOT NULL"`
|
OwnerID int64 `xorm:"INDEX NOT NULL"`
|
||||||
Name string `xorm:"NOT NULL"`
|
Name string `xorm:"NOT NULL"`
|
||||||
Fingerprint string `xorm:"NOT NULL"`
|
Fingerprint string `xorm:"NOT NULL"`
|
||||||
|
@ -566,7 +566,7 @@ func RewriteAllPublicKeys() error {
|
||||||
|
|
||||||
// DeployKey represents deploy key information and its relation with repository.
|
// DeployKey represents deploy key information and its relation with repository.
|
||||||
type DeployKey struct {
|
type DeployKey struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
KeyID int64 `xorm:"UNIQUE(s) INDEX"`
|
KeyID int64 `xorm:"UNIQUE(s) INDEX"`
|
||||||
RepoID int64 `xorm:"UNIQUE(s) INDEX"`
|
RepoID int64 `xorm:"UNIQUE(s) INDEX"`
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
// AccessToken represents a personal access token.
|
// AccessToken represents a personal access token.
|
||||||
type AccessToken struct {
|
type AccessToken struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UID int64 `xorm:"INDEX"`
|
UID int64 `xorm:"INDEX"`
|
||||||
Name string
|
Name string
|
||||||
Sha1 string `xorm:"UNIQUE VARCHAR(40)"`
|
Sha1 string `xorm:"UNIQUE VARCHAR(40)"`
|
||||||
|
|
|
@ -44,7 +44,7 @@ const (
|
||||||
|
|
||||||
// User represents the object of individual and member of organization.
|
// User represents the object of individual and member of organization.
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
LowerName string `xorm:"UNIQUE NOT NULL"`
|
LowerName string `xorm:"UNIQUE NOT NULL"`
|
||||||
Name string `xorm:"UNIQUE NOT NULL"`
|
Name string `xorm:"UNIQUE NOT NULL"`
|
||||||
FullName string
|
FullName string
|
||||||
|
@ -1087,7 +1087,7 @@ func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
|
||||||
|
|
||||||
// Follow represents relations of user and his/her followers.
|
// Follow represents relations of user and his/her followers.
|
||||||
type Follow struct {
|
type Follow struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UserID int64 `xorm:"UNIQUE(follow)"`
|
UserID int64 `xorm:"UNIQUE(follow)"`
|
||||||
FollowID int64 `xorm:"UNIQUE(follow)"`
|
FollowID int64 `xorm:"UNIQUE(follow)"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// EmailAdresses is the list of all email addresses of a user. Can contain the
|
// EmailAdresses is the list of all email addresses of a user. Can contain the
|
||||||
// primary email address, but is not obligatory.
|
// primary email address, but is not obligatory.
|
||||||
type EmailAddress struct {
|
type EmailAddress struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
UID int64 `xorm:"INDEX NOT NULL"`
|
UID int64 `xorm:"INDEX NOT NULL"`
|
||||||
Email string `xorm:"UNIQUE NOT NULL"`
|
Email string `xorm:"UNIQUE NOT NULL"`
|
||||||
IsActivated bool
|
IsActivated bool
|
||||||
|
|
|
@ -92,7 +92,7 @@ const (
|
||||||
|
|
||||||
// Webhook represents a web hook object.
|
// Webhook represents a web hook object.
|
||||||
type Webhook struct {
|
type Webhook struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64
|
RepoID int64
|
||||||
OrgID int64
|
OrgID int64
|
||||||
URL string `xorm:"url TEXT"`
|
URL string `xorm:"url TEXT"`
|
||||||
|
@ -407,7 +407,7 @@ type HookResponse struct {
|
||||||
|
|
||||||
// HookTask represents a hook task.
|
// HookTask represents a hook task.
|
||||||
type HookTask struct {
|
type HookTask struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64
|
||||||
RepoID int64 `xorm:"INDEX"`
|
RepoID int64 `xorm:"INDEX"`
|
||||||
HookID int64
|
HookID int64
|
||||||
UUID string
|
UUID string
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue