@@ -7,16 +7,46 @@ import (
77 "code.gitea.io/gitea/modules/timeutil"
88
99 "xorm.io/xorm"
10+ "xorm.io/xorm/schemas"
1011)
1112
12- func CreateTableIssueDevLink (x * xorm.Engine ) error {
13- type IssueDevLink struct {
14- ID int64 `xorm:"pk autoincr"`
15- IssueID int64 `xorm:"INDEX"`
16- LinkType int
17- LinkedRepoID int64 `xorm:"INDEX"` // it can link to self repo or other repo
18- LinkIndex string // branch name, pull request number or commit sha
19- CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
20- }
21- return x .Sync (new (IssueDevLink ))
13+ type improveActionTableIndicesAction struct {
14+ ID int64 `xorm:"pk autoincr"`
15+ UserID int64 `xorm:"INDEX"` // Receiver user id.
16+ OpType int
17+ ActUserID int64 // Action user id.
18+ RepoID int64
19+ CommentID int64 `xorm:"INDEX"`
20+ IsDeleted bool `xorm:"NOT NULL DEFAULT false"`
21+ RefName string
22+ IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
23+ Content string `xorm:"TEXT"`
24+ CreatedUnix timeutil.TimeStamp `xorm:"created"`
25+ }
26+
27+ // TableName sets the name of this table
28+ func (* improveActionTableIndicesAction ) TableName () string {
29+ return "action"
30+ }
31+
32+ func (a * improveActionTableIndicesAction ) TableIndices () []* schemas.Index {
33+ repoIndex := schemas .NewIndex ("r_u_d" , schemas .IndexType )
34+ repoIndex .AddColumn ("repo_id" , "user_id" , "is_deleted" )
35+
36+ actUserIndex := schemas .NewIndex ("au_r_c_u_d" , schemas .IndexType )
37+ actUserIndex .AddColumn ("act_user_id" , "repo_id" , "created_unix" , "user_id" , "is_deleted" )
38+
39+ cudIndex := schemas .NewIndex ("c_u_d" , schemas .IndexType )
40+ cudIndex .AddColumn ("created_unix" , "user_id" , "is_deleted" )
41+
42+ cuIndex := schemas .NewIndex ("c_u" , schemas .IndexType )
43+ cuIndex .AddColumn ("user_id" , "is_deleted" )
44+
45+ indices := []* schemas.Index {actUserIndex , repoIndex , cudIndex , cuIndex }
46+
47+ return indices
48+ }
49+
50+ func AddNewIndexForUserDashboard (x * xorm.Engine ) error {
51+ return x .Sync (new (improveActionTableIndicesAction ))
2252}
0 commit comments