From 248b8bb0fa999f2d7512f33fe50f847046130f01 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Fri, 22 Dec 2023 16:52:28 +0100 Subject: [PATCH] Revert "improve possible performance bottleneck (#28547) (#28578)" This reverts commit 7ddb1291ea9ced6bcf932331837de659007dd7d9. Does not work at all. --- models/issues/comment.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 8dc8c7682d..88730836e5 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -1166,9 +1166,14 @@ func DeleteComment(ctx context.Context, comment *Comment) error { // UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error { _, err := db.GetEngine(ctx).Table("comment"). - Join("INNER", "issue", "issue.id = comment.issue_id"). - Join("INNER", "repository", "issue.repo_id = repository.id"). - Where("repository.original_service_type = ?", tp). + Where(builder.In("issue_id", + builder.Select("issue.id"). + From("issue"). + InnerJoin("repository", "issue.repo_id = repository.id"). + Where(builder.Eq{ + "repository.original_service_type": tp, + }), + )). And("comment.original_author_id = ?", originalAuthorID). Update(map[string]any{ "poster_id": posterID,