Skip to content

Commit f4c526e

Browse files
lunnyGiteaBot
authored andcommitted
Revert "improve possible performance bottleneck (go-gitea#28547)" (go-gitea#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 5b104a5 commit f4c526e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

models/issues/comment.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,14 @@ func DeleteComment(ctx context.Context, comment *Comment) error {
11531153
// UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id
11541154
func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
11551155
_, err := db.GetEngine(ctx).Table("comment").
1156-
Join("INNER", "issue", "issue.id = comment.issue_id").
1157-
Join("INNER", "repository", "issue.repo_id = repository.id").
1158-
Where("repository.original_service_type = ?", tp).
1156+
Where(builder.In("issue_id",
1157+
builder.Select("issue.id").
1158+
From("issue").
1159+
InnerJoin("repository", "issue.repo_id = repository.id").
1160+
Where(builder.Eq{
1161+
"repository.original_service_type": tp,
1162+
}),
1163+
)).
11591164
And("comment.original_author_id = ?", originalAuthorID).
11601165
Update(map[string]any{
11611166
"poster_id": posterID,

0 commit comments

Comments
 (0)