Browse Source

models: remove redundant tags for primary keys

Unknwon 7 years ago
parent
commit
ce6e8ed8fe

+ 1 - 1
models/access.go

@@ -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
 // repository, the members of the owners team are in this table.
 type Access struct {
-	ID     int64 `xorm:"pk autoincr"`
+	ID     int64
 	UserID int64 `xorm:"UNIQUE(s)"`
 	RepoID int64 `xorm:"UNIQUE(s)"`
 	Mode   AccessMode

+ 2 - 2
models/admin.go

@@ -15,8 +15,8 @@ import (
 	"github.com/go-xorm/xorm"
 	log "gopkg.in/clog.v1"
 
-	"github.com/gogits/gogs/pkg/tool"
 	"github.com/gogits/gogs/pkg/setting"
+	"github.com/gogits/gogs/pkg/tool"
 )
 
 type NoticeType int
@@ -27,7 +27,7 @@ const (
 
 // Notice represents a system notice for admin.
 type Notice struct {
-	ID          int64 `xorm:"pk autoincr"`
+	ID          int64
 	Type        NoticeType
 	Description string    `xorm:"TEXT"`
 	Created     time.Time `xorm:"-"`

+ 1 - 1
models/attachment.go

@@ -20,7 +20,7 @@ import (
 
 // Attachment represent a attachment of issue/comment/release.
 type Attachment struct {
-	ID        int64  `xorm:"pk autoincr"`
+	ID        int64
 	UUID      string `xorm:"uuid UNIQUE"`
 	IssueID   int64  `xorm:"INDEX"`
 	CommentID int64

+ 1 - 1
models/comment.go

@@ -49,7 +49,7 @@ const (
 
 // Comment represents a comment in commit and issue page.
 type Comment struct {
-	ID              int64 `xorm:"pk autoincr"`
+	ID              int64
 	Type            CommentType
 	PosterID        int64
 	Poster          *User  `xorm:"-"`

+ 3 - 3
models/issue.go

@@ -16,8 +16,8 @@ import (
 	api "github.com/gogits/go-gogs-client"
 
 	"github.com/gogits/gogs/models/errors"
-	"github.com/gogits/gogs/pkg/tool"
 	"github.com/gogits/gogs/pkg/setting"
+	"github.com/gogits/gogs/pkg/tool"
 )
 
 var (
@@ -26,7 +26,7 @@ var (
 
 // Issue represents an issue or pull request of repository.
 type Issue struct {
-	ID              int64       `xorm:"pk autoincr"`
+	ID              int64
 	RepoID          int64       `xorm:"INDEX UNIQUE(repo_index)"`
 	Repo            *Repository `xorm:"-"`
 	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.
 type IssueUser struct {
-	ID          int64 `xorm:"pk autoincr"`
+	ID          int64
 	UID         int64 `xorm:"INDEX"` // User ID.
 	IssueID     int64
 	RepoID      int64 `xorm:"INDEX"`

+ 2 - 2
models/issue_label.go

@@ -54,7 +54,7 @@ func GetLabelTemplateFile(name string) ([][2]string, error) {
 
 // Label represents a label of repository for issues.
 type Label struct {
-	ID              int64 `xorm:"pk autoincr"`
+	ID              int64
 	RepoID          int64 `xorm:"INDEX"`
 	Name            string
 	Color           string `xorm:"VARCHAR(7)"`
@@ -213,7 +213,7 @@ func DeleteLabel(repoID, labelID int64) error {
 
 // IssueLabel represetns an issue-lable relation.
 type IssueLabel struct {
-	ID      int64 `xorm:"pk autoincr"`
+	ID      int64
 	IssueID int64 `xorm:"UNIQUE(s)"`
 	LabelID int64 `xorm:"UNIQUE(s)"`
 }

+ 4 - 4
models/login_source.go

@@ -103,7 +103,7 @@ func (cfg *PAMConfig) ToDB() ([]byte, error) {
 
 // LoginSource represents an external way for authorizing users.
 type LoginSource struct {
-	ID        int64 `xorm:"pk autoincr"`
+	ID        int64
 	Type      LoginType
 	Name      string          `xorm:"UNIQUE"`
 	IsActived bool            `xorm:"NOT NULL DEFAULT false"`
@@ -327,16 +327,16 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR
 		IsActive:    true,
 		IsAdmin:     isAdmin,
 	}
-	
+
 	ok, err := IsUserExist(0, user.Name)
 	if err != nil {
 		return user, err
 	}
-	
+
 	if ok {
 		return user, UpdateUser(user)
 	}
-	
+
 	return user, CreateUser(user)
 }
 

+ 1 - 1
models/milestone.go

@@ -18,7 +18,7 @@ import (
 
 // Milestone represents a milestone of repository.
 type Milestone struct {
-	ID              int64 `xorm:"pk autoincr"`
+	ID              int64
 	RepoID          int64 `xorm:"INDEX"`
 	Name            string
 	Content         string `xorm:"TEXT"`

+ 1 - 1
models/mirror.go

@@ -27,7 +27,7 @@ var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)
 
 // Mirror represents mirror information of a repository.
 type Mirror struct {
-	ID          int64 `xorm:"pk autoincr"`
+	ID          int64
 	RepoID      int64
 	Repo        *Repository `xorm:"-"`
 	Interval    int         // Hour.

+ 1 - 1
models/org.go

@@ -237,7 +237,7 @@ func DeleteOrganization(org *User) (err error) {
 
 // OrgUser represents an organization-user relation.
 type OrgUser struct {
-	ID       int64 `xorm:"pk autoincr"`
+	ID       int64
 	Uid      int64 `xorm:"INDEX UNIQUE(s)"`
 	OrgID    int64 `xorm:"INDEX UNIQUE(s)"`
 	IsPublic bool

+ 2 - 2
models/org_team.go

@@ -16,7 +16,7 @@ const OWNER_TEAM = "Owners"
 
 // Team represents a organization team.
 type Team struct {
-	ID          int64 `xorm:"pk autoincr"`
+	ID          int64
 	OrgID       int64 `xorm:"INDEX"`
 	LowerName   string
 	Name        string
@@ -406,7 +406,7 @@ func DeleteTeam(t *Team) error {
 
 // TeamUser represents an team-user relation.
 type TeamUser struct {
-	ID     int64 `xorm:"pk autoincr"`
+	ID     int64
 	OrgID  int64 `xorm:"INDEX"`
 	TeamID int64 `xorm:"UNIQUE(s)"`
 	UID    int64 `xorm:"UNIQUE(s)"`

+ 1 - 1
models/pull.go

@@ -43,7 +43,7 @@ const (
 
 // PullRequest represents relation between pull request and repositories.
 type PullRequest struct {
-	ID     int64 `xorm:"pk autoincr"`
+	ID     int64
 	Type   PullRequestType
 	Status PullRequestStatus
 

+ 1 - 1
models/release.go

@@ -22,7 +22,7 @@ import (
 
 // Release represents a release of repository.
 type Release struct {
-	ID               int64 `xorm:"pk autoincr"`
+	ID               int64
 	RepoID           int64
 	Repo             *Repository `xorm:"-"`
 	PublisherID      int64

+ 3 - 3
models/repo.go

@@ -141,7 +141,7 @@ func NewRepoContext() {
 
 // Repository contains information of a repository.
 type Repository struct {
-	ID            int64  `xorm:"pk autoincr"`
+	ID            int64
 	OwnerID       int64  `xorm:"UNIQUE(s)"`
 	Owner         *User  `xorm:"-"`
 	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.
 type Watch struct {
-	ID     int64 `xorm:"pk autoincr"`
+	ID     int64
 	UserID int64 `xorm:"UNIQUE(watch)"`
 	RepoID int64 `xorm:"UNIQUE(watch)"`
 }
@@ -2161,7 +2161,7 @@ func NotifyWatchers(act *Action) error {
 //         \/           \/
 
 type Star struct {
-	ID     int64 `xorm:"pk autoincr"`
+	ID     int64
 	UID    int64 `xorm:"UNIQUE(s)"`
 	RepoID int64 `xorm:"UNIQUE(s)"`
 }

+ 1 - 1
models/repo_collaboration.go

@@ -14,7 +14,7 @@ import (
 
 // Collaboration represent the relation between an individual and a repository.
 type Collaboration struct {
-	ID     int64      `xorm:"pk autoincr"`
+	ID     int64
 	RepoID int64      `xorm:"UNIQUE(s) INDEX NOT NULL"`
 	UserID int64      `xorm:"UNIQUE(s) INDEX NOT NULL"`
 	Mode   AccessMode `xorm:"DEFAULT 2 NOT NULL"`

+ 1 - 1
models/repo_editor.go

@@ -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
 type Upload struct {
-	ID   int64  `xorm:"pk autoincr"`
+	ID   int64
 	UUID string `xorm:"uuid UNIQUE"`
 	Name string
 }

+ 2 - 2
models/ssh_key.go

@@ -43,7 +43,7 @@ const (
 
 // PublicKey represents a user or deploy SSH public key.
 type PublicKey struct {
-	ID          int64      `xorm:"pk autoincr"`
+	ID          int64
 	OwnerID     int64      `xorm:"INDEX NOT NULL"`
 	Name        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.
 type DeployKey struct {
-	ID          int64 `xorm:"pk autoincr"`
+	ID          int64
 	KeyID       int64 `xorm:"UNIQUE(s) INDEX"`
 	RepoID      int64 `xorm:"UNIQUE(s) INDEX"`
 	Name        string

+ 1 - 1
models/token.go

@@ -15,7 +15,7 @@ import (
 
 // AccessToken represents a personal access token.
 type AccessToken struct {
-	ID   int64 `xorm:"pk autoincr"`
+	ID   int64
 	UID  int64 `xorm:"INDEX"`
 	Name string
 	Sha1 string `xorm:"UNIQUE VARCHAR(40)"`

+ 2 - 2
models/user.go

@@ -44,7 +44,7 @@ const (
 
 // User represents the object of individual and member of organization.
 type User struct {
-	ID        int64  `xorm:"pk autoincr"`
+	ID        int64
 	LowerName string `xorm:"UNIQUE NOT NULL"`
 	Name      string `xorm:"UNIQUE NOT NULL"`
 	FullName  string
@@ -1087,7 +1087,7 @@ func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
 
 // Follow represents relations of user and his/her followers.
 type Follow struct {
-	ID       int64 `xorm:"pk autoincr"`
+	ID       int64
 	UserID   int64 `xorm:"UNIQUE(follow)"`
 	FollowID int64 `xorm:"UNIQUE(follow)"`
 }

+ 1 - 1
models/user_mail.go

@@ -14,7 +14,7 @@ import (
 // EmailAdresses is the list of all email addresses of a user. Can contain the
 // primary email address, but is not obligatory.
 type EmailAddress struct {
-	ID          int64  `xorm:"pk autoincr"`
+	ID          int64
 	UID         int64  `xorm:"INDEX NOT NULL"`
 	Email       string `xorm:"UNIQUE NOT NULL"`
 	IsActivated bool

+ 2 - 2
models/webhook.go

@@ -92,7 +92,7 @@ const (
 
 // Webhook represents a web hook object.
 type Webhook struct {
-	ID           int64 `xorm:"pk autoincr"`
+	ID           int64
 	RepoID       int64
 	OrgID        int64
 	URL          string `xorm:"url TEXT"`
@@ -407,7 +407,7 @@ type HookResponse struct {
 
 // HookTask represents a hook task.
 type HookTask struct {
-	ID              int64 `xorm:"pk autoincr"`
+	ID              int64
 	RepoID          int64 `xorm:"INDEX"`
 	HookID          int64
 	UUID            string

File diff suppressed because it is too large
+ 0 - 0
pkg/bindata/bindata.go


Some files were not shown because too many files changed in this diff