Skip to content

Commit

Permalink
Revert "improve possible performance bottleneck (#28547)" (#28593) (#…
Browse files Browse the repository at this point in the history
…28608)

Backport #28593 by @lunny

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.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
GiteaBot and lunny committed Dec 25, 2023
1 parent 8a46a64 commit b258833
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions models/issues/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b258833

Please sign in to comment.