Skip to content

Commit 09c4ea7

Browse files
committed
fix: add full index to migration
1 parent 0d3fce9 commit 09c4ea7

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

models/migrations/v1_23/v307.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,39 @@ func (*improveNotificationTableIndicesAction) TableName() string {
3535

3636
// TableIndices implements xorm's TableIndices interface
3737
func (*improveNotificationTableIndicesAction) TableIndices() []*schemas.Index {
38+
indices := make([]*schemas.Index, 0, 8)
3839
usuuIndex := schemas.NewIndex("u_s_uu", schemas.IndexType)
3940
usuuIndex.AddColumn("user_id", "status", "updated_unix")
40-
indices := []*schemas.Index{usuuIndex}
41+
indices = append(indices, usuuIndex)
42+
43+
// Add the individual indices that were previously defined in struct tags
44+
userIDIndex := schemas.NewIndex("idx_notification_user_id", schemas.IndexType)
45+
userIDIndex.AddColumn("user_id")
46+
indices = append(indices, userIDIndex)
47+
48+
repoIDIndex := schemas.NewIndex("idx_notification_repo_id", schemas.IndexType)
49+
repoIDIndex.AddColumn("repo_id")
50+
indices = append(indices, repoIDIndex)
51+
52+
statusIndex := schemas.NewIndex("idx_notification_status", schemas.IndexType)
53+
statusIndex.AddColumn("status")
54+
indices = append(indices, statusIndex)
55+
56+
sourceIndex := schemas.NewIndex("idx_notification_source", schemas.IndexType)
57+
sourceIndex.AddColumn("source")
58+
indices = append(indices, sourceIndex)
59+
60+
issueIDIndex := schemas.NewIndex("idx_notification_issue_id", schemas.IndexType)
61+
issueIDIndex.AddColumn("issue_id")
62+
indices = append(indices, issueIDIndex)
63+
64+
commitIDIndex := schemas.NewIndex("idx_notification_commit_id", schemas.IndexType)
65+
commitIDIndex.AddColumn("commit_id")
66+
indices = append(indices, commitIDIndex)
67+
68+
updatedByIndex := schemas.NewIndex("idx_notification_updated_by", schemas.IndexType)
69+
updatedByIndex.AddColumn("updated_by")
70+
indices = append(indices, updatedByIndex)
4171

4272
return indices
4373
}

0 commit comments

Comments
 (0)