diff options
author | zeripath <art27@cantab.net> | 2020-09-10 20:45:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 20:45:01 +0100 |
commit | 47289344e2ede03b7a74208aad3b92c8bca979c3 (patch) | |
tree | e1920df9ef18854585ed08136249ad185bc1cf96 /models/topic.go | |
parent | 4f8dad37f834833012004bf5b158e5129af4b610 (diff) | |
download | gitea-47289344e2ede03b7a74208aad3b92c8bca979c3.tar.gz gitea-47289344e2ede03b7a74208aad3b92c8bca979c3.zip |
Add Primary Key to Topic and RepoTopic (#12639)
Add a primary key to Topic and RepoTopic tables
Fix #8920
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/topic.go')
-rw-r--r-- | models/topic.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models/topic.go b/models/topic.go index 4a5bffa08a..0075c1702d 100644 --- a/models/topic.go +++ b/models/topic.go @@ -25,7 +25,7 @@ var topicPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`) // Topic represents a topic of repositories type Topic struct { - ID int64 + ID int64 `xorm:"pk autoincr"` Name string `xorm:"UNIQUE VARCHAR(25)"` RepoCount int CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` @@ -34,8 +34,8 @@ type Topic struct { // RepoTopic represents associated repositories and topics type RepoTopic struct { - RepoID int64 `xorm:"UNIQUE(s)"` - TopicID int64 `xorm:"UNIQUE(s)"` + RepoID int64 `xorm:"pk"` + TopicID int64 `xorm:"pk"` } // ErrTopicNotExist represents an error that a topic is not exist |