aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v216.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-07-01 17:04:01 +0100
committerGitHub <noreply@github.com>2022-07-01 17:04:01 +0100
commit5c9c0b8c1ef7a472f11d513d72807b624997aba8 (patch)
treead46116915c5fc6d2e6cecacfee52c4e8aee2a2e /models/migrations/v216.go
parent54e7483207343ff50d60dd5a54065df90c356943 (diff)
downloadgitea-5c9c0b8c1ef7a472f11d513d72807b624997aba8.tar.gz
gitea-5c9c0b8c1ef7a472f11d513d72807b624997aba8.zip
Refix indices on actions table (#20158)
Unforunately the previous PR #20035 created indices that were not helpful for SQLite. This PR adjusts these after testing using the try.gitea.io db. Fix #20129 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/migrations/v216.go')
-rw-r--r--models/migrations/v216.go42
1 files changed, 2 insertions, 40 deletions
diff --git a/models/migrations/v216.go b/models/migrations/v216.go
index 67c360016d..ab44808402 100644
--- a/models/migrations/v216.go
+++ b/models/migrations/v216.go
@@ -4,43 +4,5 @@
package migrations
-import (
- "code.gitea.io/gitea/modules/timeutil"
-
- "xorm.io/xorm"
- "xorm.io/xorm/schemas"
-)
-
-type improveActionTableIndicesAction struct {
- ID int64 `xorm:"pk autoincr"`
- UserID int64 // Receiver user id.
- OpType int
- ActUserID int64 // Action user id.
- RepoID int64
- CommentID int64 `xorm:"INDEX"`
- IsDeleted bool `xorm:"NOT NULL DEFAULT false"`
- RefName string
- IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
- Content string `xorm:"TEXT"`
- CreatedUnix timeutil.TimeStamp `xorm:"created"`
-}
-
-// TableName sets the name of this table
-func (a *improveActionTableIndicesAction) TableName() string {
- return "action"
-}
-
-// TableIndices implements xorm's TableIndices interface
-func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index {
- actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
- actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
-
- repoIndex := schemas.NewIndex("r_c_u_d", schemas.IndexType)
- repoIndex.AddColumn("repo_id", "created_unix", "user_id", "is_deleted")
-
- return []*schemas.Index{actUserIndex, repoIndex}
-}
-
-func improveActionTableIndices(x *xorm.Engine) error {
- return x.Sync2(&improveActionTableIndicesAction{})
-}
+// This migration added non-ideal indices to the action table which on larger datasets slowed things down
+// it has been superceded by v218.go