Skip to content

Commit 62cb3c8

Browse files
authored
Simplify and fix migration 216 (#20035)
There appears to be a strange bug whereby the comment_id index can sometimes be missed or missing from the action table despite the sync2 that should create it in the earlier part of this migration. However, looking through the code for Sync2 there is no need for this pre-code to exist and Sync2 should drop/create the indices as necessary. I think therefore we should simplify the migration to simply be Sync2. Signed-off-by: Andrew Thornton <[email protected]>
1 parent 05a74e6 commit 62cb3c8

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

models/migrations/v216.go

-21
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,5 @@ func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index {
4242
}
4343

4444
func improveActionTableIndices(x *xorm.Engine) error {
45-
{
46-
type Action struct {
47-
ID int64 `xorm:"pk autoincr"`
48-
UserID int64 `xorm:"INDEX"` // Receiver user id.
49-
OpType int
50-
ActUserID int64 `xorm:"INDEX"` // Action user id.
51-
RepoID int64 `xorm:"INDEX"`
52-
CommentID int64 `xorm:"INDEX"`
53-
IsDeleted bool `xorm:"INDEX NOT NULL DEFAULT false"`
54-
RefName string
55-
IsPrivate bool `xorm:"INDEX NOT NULL DEFAULT false"`
56-
Content string `xorm:"TEXT"`
57-
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
58-
}
59-
if err := x.Sync2(&Action{}); err != nil {
60-
return err
61-
}
62-
if err := x.DropIndexes(&Action{}); err != nil {
63-
return err
64-
}
65-
}
6645
return x.Sync2(&improveActionTableIndicesAction{})
6746
}

0 commit comments

Comments
 (0)