|
|
@ -208,20 +208,24 @@ func InsertReleases(rels ...*Release) error { |
|
|
|
return sess.Commit() |
|
|
|
return sess.Commit() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func migratedIssueCond(tp structs.GitServiceType) builder.Cond { |
|
|
|
|
|
|
|
return 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, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UpdateReviewsMigrationsByType updates reviews' migrations information via given git service type and original id and poster id
|
|
|
|
// UpdateReviewsMigrationsByType updates reviews' migrations information via given git service type and original id and poster id
|
|
|
|
func UpdateReviewsMigrationsByType(tp structs.GitServiceType, originalAuthorID string, posterID int64) error { |
|
|
|
func UpdateReviewsMigrationsByType(tp structs.GitServiceType, originalAuthorID string, posterID int64) error { |
|
|
|
_, err := x.Table("review"). |
|
|
|
_, err := x.Table("review"). |
|
|
|
Where(builder.In("issue_id", |
|
|
|
Where("original_author_id = ?", originalAuthorID). |
|
|
|
builder.Select("issue.id"). |
|
|
|
And(migratedIssueCond(tp)). |
|
|
|
From("issue"). |
|
|
|
|
|
|
|
InnerJoin("repository", "issue.repo_id = repository.id"). |
|
|
|
|
|
|
|
Where(builder.Eq{ |
|
|
|
|
|
|
|
"repository.original_service_type": tp, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
)). |
|
|
|
|
|
|
|
And("review.original_author_id = ?", originalAuthorID). |
|
|
|
|
|
|
|
Update(map[string]interface{}{ |
|
|
|
Update(map[string]interface{}{ |
|
|
|
"poster_id": posterID, |
|
|
|
"reviewer_id": posterID, |
|
|
|
"original_author": "", |
|
|
|
"original_author": "", |
|
|
|
"original_author_id": 0, |
|
|
|
"original_author_id": 0, |
|
|
|
}) |
|
|
|
}) |
|
|
|