summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-12-25 16:01:11 +0800
committerGitHub <noreply@github.com>2023-12-25 08:01:11 +0000
commitb2588338f0795c259ffe92236ae8341dd4f4cec5 (patch)
tree35c3dbaa4dd8726253d1d36d22f2f211a5916a0f
parent8a46a6417e7ff181e876e19f8e73d804316e9c1b (diff)
downloadgitea-b2588338f0795c259ffe92236ae8341dd4f4cec5.tar.gz
gitea-b2588338f0795c259ffe92236ae8341dd4f4cec5.zip
Revert "improve possible performance bottleneck (#28547)" (#28593) (#28608)
Backport #28593 by @lunny 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. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
-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 f038d75eb3..9eaa8a6eba 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -1153,9 +1153,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,