Fix bug of migraition v111 (#12738)

This commit is contained in:
Lunny Xiao 2020-09-06 18:34:51 +08:00 committed by GitHub
parent 0cc4aadf58
commit e8958bfc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -380,10 +380,10 @@ func addBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error {
}
totalPages := totalIssues / pageSize
// Find latest review of each user in each pull request, and set official field if appropriate
reviews := []*Review{}
var executeBody = func(page, pageSize int64) error {
// Find latest review of each user in each pull request, and set official field if appropriate
reviews := []*Review{}
if err := x.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id > ? AND issue_id <= ? AND type in (?, ?) GROUP BY issue_id, reviewer_id)",
page*pageSize, (page+1)*pageSize, ReviewTypeApprove, ReviewTypeReject).
Find(&reviews); err != nil {