diff options
author | Earl Warren <109468362+earl-warren@users.noreply.github.com> | 2023-12-18 16:32:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 15:32:08 +0000 |
commit | e02095c5b6e04f70ae6562f5aee169f7ee93cf7a (patch) | |
tree | 237b7683a28259a3293720e7fb653e0cdf728be2 /modules | |
parent | bf8b082c40f2aee7d3fbd3c68d73886e13381712 (diff) | |
download | gitea-e02095c5b6e04f70ae6562f5aee169f7ee93cf7a.tar.gz gitea-e02095c5b6e04f70ae6562f5aee169f7ee93cf7a.zip |
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>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/doctor/dbconsistency.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/doctor/dbconsistency.go b/modules/doctor/dbconsistency.go index ac983f9161..e2dcb63f33 100644 --- a/modules/doctor/dbconsistency.go +++ b/modules/doctor/dbconsistency.go @@ -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 |