Skip to content

Commit 0407a40

Browse files
authored
Revert "improve possible performance bottleneck (#28547)" (#28593)
This reverts commit b35d3fd. This is totally wrong. I think `Update join` hasn't been supported well by xorm. I just revert the PR and will try to send another one.
1 parent 7396e36 commit 0407a40

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

models/issues/comment.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,14 @@ func DeleteComment(ctx context.Context, comment *Comment) error {
11611161
// UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id
11621162
func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
11631163
_, err := db.GetEngine(ctx).Table("comment").
1164-
Join("INNER", "issue", "issue.id = comment.issue_id").
1165-
Join("INNER", "repository", "issue.repo_id = repository.id").
1166-
Where("repository.original_service_type = ?", tp).
1164+
Where(builder.In("issue_id",
1165+
builder.Select("issue.id").
1166+
From("issue").
1167+
InnerJoin("repository", "issue.repo_id = repository.id").
1168+
Where(builder.Eq{
1169+
"repository.original_service_type": tp,
1170+
}),
1171+
)).
11671172
And("comment.original_author_id = ?", originalAuthorID).
11681173
Update(map[string]any{
11691174
"poster_id": posterID,

0 commit comments

Comments
 (0)