Do some performance optimize for issues list and view issue/pull (#29515) (migration only)

Refs: https://codeberg.org/forgejo/forgejo/pulls/2679#issuecomment-1720941
This commit is contained in:
Lunny Xiao 2024-03-12 15:23:44 +08:00 committed by Earl Warren
parent d67e7ae25a
commit b019ecce89
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 16 additions and 0 deletions

View file

@ -568,6 +568,8 @@ var migrations = []Migration{
NewMigration("Add default_wiki_branch to repository table", v1_22.AddDefaultWikiBranch),
// v290 -> v291
NewMigration("Add PayloadVersion to HookTask", v1_22.AddPayloadVersionToHookTaskTable),
// v291 -> v292
NewMigration("Add Index to attachment.comment_id", v1_22.AddCommentIDIndexofAttachment),
}
// GetCurrentDBVersion returns the current db version

View file

@ -0,0 +1,14 @@
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v1_22 //nolint
import "xorm.io/xorm"
func AddCommentIDIndexofAttachment(x *xorm.Engine) error {
type Attachment struct {
CommentID int64 `xorm:"INDEX"`
}
return x.Sync(&Attachment{})
}