mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Add orphaned topic consistency check (#28507)
- If a topic has zero repository count, it means that none of the repositories are using that topic, that would make them 'useless' to keep. One caveat is that if that topic is going to be used in the future, it will be added again to the database, but simply with a new ID. Refs: https://codeberg.org/forgejo/forgejo/pulls/1964 Co-authored-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
bf8b082c40
commit
e02095c5b6
2 changed files with 16 additions and 0 deletions
|
@ -158,6 +158,12 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er
|
|||
Fixer: actions_model.FixRunnersWithoutBelongingOwner,
|
||||
FixedMessage: "Removed",
|
||||
},
|
||||
{
|
||||
Name: "Topics with empty repository count",
|
||||
Counter: repo_model.CountOrphanedTopics,
|
||||
Fixer: repo_model.DeleteOrphanedTopics,
|
||||
FixedMessage: "Removed",
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: function to recalc all counters
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue