mirror of
https://github.com/go-gitea/gitea
synced 2024-09-27 16:56:49 +02:00
Add more indices to action table for speed improvements
This commit is contained in:
parent
3f6ddd9bee
commit
f53e02d8ee
@ -142,17 +142,17 @@ type Action struct {
|
|||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
UserID int64 `xorm:"INDEX"` // Receiver user id.
|
UserID int64 `xorm:"INDEX"` // Receiver user id.
|
||||||
OpType ActionType
|
OpType ActionType
|
||||||
ActUserID int64 // Action user id.
|
ActUserID int64 // Action user id.
|
||||||
ActUser *user_model.User `xorm:"-"`
|
ActUser *user_model.User `xorm:"-"`
|
||||||
RepoID int64
|
RepoID int64 `xorm:"INDEX"`
|
||||||
Repo *repo_model.Repository `xorm:"-"`
|
Repo *repo_model.Repository `xorm:"-"`
|
||||||
CommentID int64 `xorm:"INDEX"`
|
CommentID int64 `xorm:"INDEX"`
|
||||||
Comment *issues_model.Comment `xorm:"-"`
|
Comment *issues_model.Comment `xorm:"-"`
|
||||||
IsDeleted bool `xorm:"NOT NULL DEFAULT false"`
|
IsDeleted bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
||||||
RefName string
|
RefName string
|
||||||
IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
|
IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
Content string `xorm:"TEXT"`
|
Content string `xorm:"TEXT"`
|
||||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -167,10 +167,13 @@ func (a *Action) TableIndices() []*schemas.Index {
|
|||||||
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
|
actUserIndex := schemas.NewIndex("au_r_c_u_d", schemas.IndexType)
|
||||||
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
|
actUserIndex.AddColumn("act_user_id", "repo_id", "created_unix", "user_id", "is_deleted")
|
||||||
|
|
||||||
|
actDashboardIndex := schemas.NewIndex("r_c_u_d", schemas.IndexType)
|
||||||
|
actDashboardIndex.AddColumn("repo_id", "created_unix", "user_id", "is_deleted")
|
||||||
|
|
||||||
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
|
cudIndex := schemas.NewIndex("c_u_d", schemas.IndexType)
|
||||||
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
|
cudIndex.AddColumn("created_unix", "user_id", "is_deleted")
|
||||||
|
|
||||||
indices := []*schemas.Index{actUserIndex, repoIndex, cudIndex}
|
indices := []*schemas.Index{actUserIndex, repoIndex, actDashboardIndex, cudIndex}
|
||||||
|
|
||||||
return indices
|
return indices
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user