Browse Source

Fix organization watch migration (#2703)

Lauris BH 2 years ago
parent
commit
8863e74f2a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      models/migrations/v46.go

+ 1 - 1
models/migrations/v46.go

@@ -25,7 +25,7 @@ func removeOrganizationWatchRepo(x *xorm.Engine) error {
25 25
 	if err := sess.Begin(); err != nil {
26 26
 		return err
27 27
 	}
28
-	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 {
28
+	if _, err := sess.Exec("DELETE FROM `watch` WHERE `user_id` IN (SELECT `id` FROM `user` WHERE `type` = ?)", UserTypeOrganization); err != nil {
29 29
 		return err
30 30
 	}
31 31
 	if _, err := sess.Exec("UPDATE `repository` SET num_watches = (SELECT count(*) FROM watch WHERE `repository`.`id` = watch.repo_id)"); err != nil {