diff --git a/models/index.go b/models/index.go index 18db13c49..121a149ca 100644 --- a/models/index.go +++ b/models/index.go @@ -14,7 +14,7 @@ import ( // ResourceIndex represents a resource index which could be used as issue/release and others // We can create different tables i.e. issue_index, release_index and etc. type ResourceIndex struct { - GroupID int64 `xorm:"unique"` + GroupID int64 `xorm:"pk"` MaxIndex int64 `xorm:"index"` } diff --git a/models/migrations/v182.go b/models/migrations/v182.go index dd9a04f27..29c2d2654 100644 --- a/models/migrations/v182.go +++ b/models/migrations/v182.go @@ -10,8 +10,8 @@ import ( func addIssueResourceIndexTable(x *xorm.Engine) error { type ResourceIndex struct { - GroupID int64 `xorm:"index unique(s)"` - MaxIndex int64 `xorm:"index unique(s)"` + GroupID int64 `xorm:"pk"` + MaxIndex int64 `xorm:"index"` } sess := x.NewSession() diff --git a/models/migrations/v182_test.go b/models/migrations/v182_test.go index 6f418f779..9fb371e07 100644 --- a/models/migrations/v182_test.go +++ b/models/migrations/v182_test.go @@ -33,8 +33,8 @@ func Test_addIssueResourceIndexTable(t *testing.T) { } type ResourceIndex struct { - GroupID int64 `xorm:"index unique(s)"` - MaxIndex int64 `xorm:"index unique(s)"` + GroupID int64 `xorm:"pk"` + MaxIndex int64 `xorm:"index"` } var start = 0