aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-12-25 14:52:17 +0800
committerGitHub <noreply@github.com>2023-12-25 06:52:17 +0000
commit0407a402bb29a3643e2b4a8992f1d7687a88b40c (patch)
treec4bf56f9cec863b906df51d2555f9e26b5f10b6d
parent7396e3618d61bfd68853fce6edd74200efe23d9b (diff)
downloadgitea-0407a402bb29a3643e2b4a8992f1d7687a88b40c.tar.gz
gitea-0407a402bb29a3643e2b4a8992f1d7687a88b40c.zip
Revert "improve possible performance bottleneck (#28547)" (#28593)
This reverts commit b35d3fddfac389a7be401a63b4e1283dd74af681. 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.
-rw-r--r--models/issues/comment.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go
index ce5cf5902d..ba5aed9c65 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -1161,9 +1161,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,