0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-21 21:23:36 +01:00

Fix organization watch migration (#2703)

This commit is contained in:
Lauris BH 2017-10-14 20:47:05 +03:00 committed by GitHub
parent e89bb7ef6a
commit 8863e74f2a

View 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 {