Browse Source

Optimize sql statement

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

2
models/migrations/v18.go

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

Loading…
Cancel
Save