From dfb3e50dcea581b256d0fdf141d0c8fa8d75d78d Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 22 Mar 2021 18:26:38 +0000 Subject: [PATCH] Fix the v176 migration (#15110) There is a serious issue with the v176 migration where there is a mistaken missing label_id selection. *introduced by #14912* Signed-off-by: Andrew Thornton --- models/consistency.go | 2 +- models/migrations/v176.go | 2 +- models/repo_transfer.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/consistency.go b/models/consistency.go index 9d76d26bbb..9f4cf759c7 100644 --- a/models/consistency.go +++ b/models/consistency.go @@ -380,7 +380,7 @@ func FixIssueLabelWithOutsideLabels() (int64, error) { SELECT il_too.id FROM ( SELECT il_too_too.id FROM issue_label AS il_too_too - INNER JOIN label ON il_too_too.id = label.id + INNER JOIN label ON il_too_too.label_id = label.id INNER JOIN issue on issue.id = il_too_too.issue_id INNER JOIN repository on repository.id = issue.repo_id WHERE diff --git a/models/migrations/v176.go b/models/migrations/v176.go index ff6587508d..0365ae5673 100644 --- a/models/migrations/v176.go +++ b/models/migrations/v176.go @@ -48,7 +48,7 @@ func removeInvalidLabels(x *xorm.Engine) error { SELECT il_too.id FROM ( SELECT il_too_too.id FROM issue_label AS il_too_too - INNER JOIN label ON il_too_too.id = label.id + INNER JOIN label ON il_too_too.label_id = label.id INNER JOIN issue on issue.id = il_too_too.issue_id INNER JOIN repository on repository.id = issue.repo_id WHERE diff --git a/models/repo_transfer.go b/models/repo_transfer.go index c1326a1ac6..60f3d15734 100644 --- a/models/repo_transfer.go +++ b/models/repo_transfer.go @@ -330,7 +330,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) (err e SELECT il_too.id FROM ( SELECT il_too_too.id FROM issue_label AS il_too_too - INNER JOIN label ON il_too_too.id = label.id + INNER JOIN label ON il_too_too.label_id = label.id INNER JOIN issue on issue.id = il_too_too.issue_id WHERE issue.repo_id = ? AND (issue.repo_id != label.repo_id OR (label.repo_id = 0 AND label.org_id != ?))