loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Index to `action.user_id` (#27403)

Another Column that needs a Index. Found at
https://codeberg.org/forgejo/discussions/issues/61#issuecomment-1258744.

Co-authored-by: Giteabot <teabot@gitea.io>

authored by

JakobDev
Giteabot
and committed by
GitHub
4636f56e b37f3332

+19 -1
+1 -1
models/activities/action.go
··· 140 140 // used in template render. 141 141 type Action struct { 142 142 ID int64 `xorm:"pk autoincr"` 143 - UserID int64 // Receiver user id. 143 + UserID int64 `xorm:"INDEX"` // Receiver user id. 144 144 OpType ActionType 145 145 ActUserID int64 // Action user id. 146 146 ActUser *user_model.User `xorm:"-"`
+2
models/migrations/migrations.go
··· 538 538 NewMigration("Add Index to issue_user.issue_id", v1_21.AddIndexToIssueUserIssueID), 539 539 // v278 -> v279 540 540 NewMigration("Add Index to comment.dependent_issue_id", v1_21.AddIndexToCommentDependentIssueID), 541 + // v279 -> v280 542 + NewMigration("Add Index to action.user_id", v1_21.AddIndexToActionUserID), 541 543 } 542 544 543 545 // GetCurrentDBVersion returns the current db version
+16
models/migrations/v1_21/v279.go
··· 1 + // Copyright 2023 The Gitea Authors. All rights reserved. 2 + // SPDX-License-Identifier: MIT 3 + 4 + package v1_21 //nolint 5 + 6 + import ( 7 + "xorm.io/xorm" 8 + ) 9 + 10 + func AddIndexToActionUserID(x *xorm.Engine) error { 11 + type Action struct { 12 + UserID int64 `xorm:"INDEX"` 13 + } 14 + 15 + return x.Sync(new(Action)) 16 + }