Browse Source

Revert "improve possible performance bottleneck (#28547)" (#28593)

This reverts commit b35d3fddfa.

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.
pull/28196/merge
Lunny Xiao 2 years ago committed by GitHub
parent
commit
0407a402bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      models/issues/comment.go

11
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 // 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 { func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
_, err := db.GetEngine(ctx).Table("comment"). _, err := db.GetEngine(ctx).Table("comment").
Join("INNER", "issue", "issue.id = comment.issue_id"). Where(builder.In("issue_id",
Join("INNER", "repository", "issue.repo_id = repository.id"). builder.Select("issue.id").
Where("repository.original_service_type = ?", tp). From("issue").
InnerJoin("repository", "issue.repo_id = repository.id").
Where(builder.Eq{
"repository.original_service_type": tp,
}),
)).
And("comment.original_author_id = ?", originalAuthorID). And("comment.original_author_id = ?", originalAuthorID).
Update(map[string]any{ Update(map[string]any{
"poster_id": posterID, "poster_id": posterID,

Loading…
Cancel
Save