Skip to content
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

Update topics repo count when deleting repository #10051

Merged
merged 4 commits into from
Jan 31, 2020

Conversation

lafriks
Copy link
Member

@lafriks lafriks commented Jan 29, 2020

Fixes #10038

@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #10051 into master will decrease coverage by <.01%.
The diff coverage is 14.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10051      +/-   ##
==========================================
- Coverage   42.29%   42.29%   -0.01%     
==========================================
  Files         619      619              
  Lines       80879    80879              
==========================================
- Hits        34211    34210       -1     
- Misses      42458    42461       +3     
+ Partials     4210     4208       -2
Impacted Files Coverage Δ
modules/cache/cache.go 28.57% <ø> (ø) ⬆️
modules/setting/cache.go 73.33% <ø> (ø) ⬆️
cmd/doctor.go 0% <0%> (ø) ⬆️
modules/options/dynamic.go 68.62% <0%> (ø) ⬆️
routers/admin/admin.go 10.43% <0%> (ø) ⬆️
modules/setting/cors.go 25% <0%> (ø) ⬆️
modules/setting/session.go 86.95% <100%> (ø) ⬆️
routers/routes/routes.go 86.52% <52.63%> (ø) ⬆️
models/unit.go 37.03% <0%> (-2.47%) ⬇️
... and 10 more

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 50b6963...fec9d1e. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 29, 2020
models/migrations/v126.go Outdated Show resolved Hide resolved
models/migrations/v126.go Outdated Show resolved Hide resolved
@lafriks
Copy link
Member Author

lafriks commented Jan 30, 2020

@lunny @guillep2k updated to single update command using xorm builder.

FYI: .Where(builder.Eq{"'1'": "1"})) is needed as xorm builder otherwise generates invalid SQL

"`repo_count`": builder.Select("count(*)").From("`repo_topic`").Where(builder.Eq{
"`repo_topic`.`topic_id`": builder.Expr("`topic`.`id`"),
}),
}).From("`topic`").Where(builder.Eq{"'1'": "1"}))
Copy link
Member

Choose a reason for hiding this comment

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

Interesting!

Copy link
Contributor

Choose a reason for hiding this comment

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

Such cunning evilness

Copy link
Member Author

Choose a reason for hiding this comment

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

I just wanted to see if it can be done 😆

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 30, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 30, 2020
@lafriks lafriks merged commit b3d8e2d into go-gitea:master Jan 31, 2020
@lafriks lafriks deleted the fix/repo_delete_topics branch January 31, 2020 06:57
@lafriks lafriks added the backport/done All backports for this PR have been created label Jan 31, 2020
@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
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Counts of tags are not decreased when deleting a repository
7 participants