]> source.dussan.org Git - gitea.git/commitdiff
Fix organization watch migration (#2703)
authorLauris BH <lauris@nix.lv>
Sat, 14 Oct 2017 17:47:05 +0000 (20:47 +0300)
committerGitHub <noreply@github.com>
Sat, 14 Oct 2017 17:47:05 +0000 (20:47 +0300)
models/migrations/v46.go

index 3cc35a300fb2c358e50f501b8ce5d284e692621d..b6dd059c94e2af89fe1eed7d927748f0a8844fec 100644 (file)
@@ -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 {