Skip to content

Commit a1360ce

Browse files
Loïc Dacharyrealaravinth
Loïc Dachary
authored andcommitted
models: update num_comments for type=0 during migrations
The num_comment field is only about the comments of type CommentTypeComment, i.e. 0. Signed-off-by: Loïc Dachary <[email protected]>
1 parent 2d3266b commit a1360ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func InsertIssueComments(comments []*Comment) error {
166166
}
167167

168168
for issueID := range issueIDs {
169-
if _, err := db.Exec(ctx, "UPDATE issue set num_comments = (SELECT count(*) FROM comment WHERE issue_id = ?) WHERE id = ?", issueID, issueID); err != nil {
169+
if _, err := db.Exec(ctx, "UPDATE issue set num_comments = (SELECT count(*) FROM comment WHERE issue_id = ? AND `type`=?) WHERE id = ?", issueID, CommentTypeComment, issueID); err != nil {
170170
return err
171171
}
172172
}

0 commit comments

Comments
 (0)