diff options
author | Jason Song <i@wolfogre.com> | 2022-12-23 19:35:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-23 19:35:43 +0800 |
commit | 71ca3067bcc6c7c7772d38fc7590505c8c7148ed (patch) | |
tree | 9c3719cb257e3976df229128f9f9d33056e3503d /models/foreignreference/foreignreference.go | |
parent | 41f0668da818d3a3ae74555bfe3de375448bacf3 (diff) | |
download | gitea-71ca3067bcc6c7c7772d38fc7590505c8c7148ed.tar.gz gitea-71ca3067bcc6c7c7772d38fc7590505c8c7148ed.zip |
Check primary keys for all tables and drop ForeignReference (#21721)
Some dbs require that all tables have primary keys, see
- #16802
- #21086
We can add a test to keep it from being broken again.
Edit:
~Added missing primary key for `ForeignReference`~ Dropped the
`ForeignReference` table to satisfy the check, so it closes #21086.
More context can be found in comments.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/foreignreference/foreignreference.go')
-rw-r--r-- | models/foreignreference/foreignreference.go | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/models/foreignreference/foreignreference.go b/models/foreignreference/foreignreference.go deleted file mode 100644 index 2d2ad04c5a..0000000000 --- a/models/foreignreference/foreignreference.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2022 Gitea. All rights reserved. -// SPDX-License-Identifier: MIT - -package foreignreference - -import ( - "code.gitea.io/gitea/models/db" -) - -// Type* are valid values for the Type field of ForeignReference -const ( - TypeIssue = "issue" - TypePullRequest = "pull_request" - TypeComment = "comment" - TypeReview = "review" - TypeReviewComment = "review_comment" - TypeRelease = "release" -) - -// ForeignReference represents external references -type ForeignReference struct { - // RepoID is the first column in all indices. now we only need 2 indices: (repo, local) and (repo, foreign, type) - RepoID int64 `xorm:"UNIQUE(repo_foreign_type) INDEX(repo_local)" ` - LocalIndex int64 `xorm:"INDEX(repo_local)"` // the resource key inside Gitea, it can be IssueIndex, or some model ID. - ForeignIndex string `xorm:"INDEX UNIQUE(repo_foreign_type)"` - Type string `xorm:"VARCHAR(16) INDEX UNIQUE(repo_foreign_type)"` -} - -func init() { - db.RegisterModel(new(ForeignReference)) -} |