-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix #4043 clean unlinked webhook and hook_task #4166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
models/migrations/v67.go
Outdated
@@ -0,0 +1,13 @@ | |||
// Copyright 2017 The Gitea Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright is wrong date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already change it
CI Fail. |
models/migrations/v67.go
Outdated
) | ||
|
||
func cleanUnlinkedWebhookAndHookTasks(x *xorm.Engine) error { | ||
_, 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;`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work in PostgreSQL.
SQL should be something like:
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);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you very much
/go/src/code.gitea.io/gitea/models/migrations/v67.go:1:1: package comment should be of the form "Package migrations ..." |
Codecov Report
@@ Coverage Diff @@
## master #4166 +/- ##
=======================================
Coverage 19.97% 19.97%
=======================================
Files 153 153
Lines 30494 30494
=======================================
Hits 6091 6091
Misses 23489 23489
Partials 914 914 Continue to review full report at Codecov.
|
@lunny Wait for merge |
Didn't an organization webhook have a zero repository_id? |
fix #4043 clean unlinked webhook and hook_task