Browse Source

one SQL per Exec

pull/5277/head
奶爸 7 years ago committed by GitHub
parent
commit
d1f5bced4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      models/migrations/v18.go

6
models/migrations/v18.go

@ -9,6 +9,10 @@ import (
)
func cleanUnlinkedWebhookAndHookTasks(x *xorm.Engine) error {
_, err := x.Exec(`DELETE FROM webhook WHERE repo_id NOT IN (SELECT id FROM repository);DELETE FROM hook_task WHERE repo_id NOT IN (SELECT id FROM repository);`)
_, err := x.Exec(`DELETE FROM webhook WHERE repo_id NOT IN (SELECT id FROM repository);`)
if err != nil {
return err
}
_, err = x.Exec(`DELETE FROM hook_task WHERE repo_id NOT IN (SELECT id FROM repository);`)
return err
}

Loading…
Cancel
Save