UserTypeIndividualUserType=iota// Historic reason to make it starts at 0.
// UserTypeOrganization defines an organization
UserTypeOrganization
)
sess:=x.NewSession()
defersess.Close()
iferr:=sess.Begin();err!=nil{
returnerr
}
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{
returnerr
}
if_,err:=sess.Exec("UPDATE `repository` SET num_watches = (SELECT count(*) FROM watch WHERE `repository`.`id` = watch.repo_id)");err!=nil{