Skip to content

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

Closed
wants to merge 9 commits into from
Closed

fix #4043 clean unlinked webhook and hook_task #4166

wants to merge 9 commits into from

Conversation

naiba
Copy link
Contributor

@naiba naiba commented Jun 7, 2018

fix #4043 clean unlinked webhook and hook_task

@@ -0,0 +1,13 @@
// Copyright 2017 The Gitea Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright is wrong date

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already change it

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 7, 2018
@techknowlogick
Copy link
Member

CI Fail.

)

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;`)
Copy link
Member

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much

@naiba
Copy link
Contributor Author

naiba commented Jun 8, 2018

/go/src/code.gitea.io/gitea/models/migrations/v67.go:1:1: package comment should be of the form "Package migrations ..."
Found 1 lint suggestions; failing.
@techknowlogick just a lint report

@codecov-io
Copy link

codecov-io commented Jun 8, 2018

Codecov Report

Merging #4166 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a89d625...390bded. Read the comment docs.

@naiba
Copy link
Contributor Author

naiba commented Jun 11, 2018

@lunny Wait for merge

@lunny
Copy link
Member

lunny commented Jun 11, 2018

Didn't an organization webhook have a zero repository_id?

@naiba naiba closed this Jun 13, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migration which "gc"s old unlinked records in database table
6 participants