From 8863e74f2aa7150605712eb21468b6f1305289f7 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Sat, 14 Oct 2017 20:47:05 +0300 Subject: [PATCH] Fix organization watch migration (#2703) --- models/migrations/v46.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v46.go b/models/migrations/v46.go index 3cc35a300..b6dd059c9 100644 --- a/models/migrations/v46.go +++ b/models/migrations/v46.go @@ -25,7 +25,7 @@ func removeOrganizationWatchRepo(x *xorm.Engine) error { if err := sess.Begin(); err != nil { return err } - if _, err := sess.Exec("DELETE FROM watch WHERE id IN (SELECT watch.id FROM watch INNER JOIN user ON watch.user_id = user.id WHERE `user`.`type` = ?)", UserTypeOrganization); err != nil { + if _, err := sess.Exec("DELETE FROM `watch` WHERE `user_id` IN (SELECT `id` FROM `user` WHERE `type` = ?)", UserTypeOrganization); err != nil { return err } if _, err := sess.Exec("UPDATE `repository` SET num_watches = (SELECT count(*) FROM watch WHERE `repository`.`id` = watch.repo_id)"); err != nil {