···140140// used in template render.
141141type Action struct {
142142 ID int64 `xorm:"pk autoincr"`
143143- UserID int64 // Receiver user id.
143143+ UserID int64 `xorm:"INDEX"` // Receiver user id.
144144 OpType ActionType
145145 ActUserID int64 // Action user id.
146146 ActUser *user_model.User `xorm:"-"`
+2
models/migrations/migrations.go
···538538 NewMigration("Add Index to issue_user.issue_id", v1_21.AddIndexToIssueUserIssueID),
539539 // v278 -> v279
540540 NewMigration("Add Index to comment.dependent_issue_id", v1_21.AddIndexToCommentDependentIssueID),
541541+ // v279 -> v280
542542+ NewMigration("Add Index to action.user_id", v1_21.AddIndexToActionUserID),
541543}
542544543545// GetCurrentDBVersion returns the current db version
+16
models/migrations/v1_21/v279.go
···11+// Copyright 2023 The Gitea Authors. All rights reserved.
22+// SPDX-License-Identifier: MIT
33+44+package v1_21 //nolint
55+66+import (
77+ "xorm.io/xorm"
88+)
99+1010+func AddIndexToActionUserID(x *xorm.Engine) error {
1111+ type Action struct {
1212+ UserID int64 `xorm:"INDEX"`
1313+ }
1414+1515+ return x.Sync(new(Action))
1616+}