Skip to content

Update topics repo count when deleting repository#10051

Merged
lafriks merged 4 commits into
go-gitea:masterfrom
lafriks-fork:fix/repo_delete_topics
Jan 31, 2020
Merged

Update topics repo count when deleting repository#10051
lafriks merged 4 commits into
go-gitea:masterfrom
lafriks-fork:fix/repo_delete_topics

Conversation

@lafriks
Copy link
Copy Markdown
Member

@lafriks lafriks commented Jan 29, 2020

Fixes #10038

@codecov-io
Copy link
Copy Markdown

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
Comment thread models/migrations/v126.go Outdated
Comment thread models/migrations/v126.go Outdated
@lafriks
Copy link
Copy Markdown
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

Comment thread models/migrations/v126.go
"`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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting!

Copy link
Copy Markdown
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
Copy Markdown
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