From 15fa0383fb5dd9ad1702dbc34ba7100c0cdbcc8c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 28 Sep 2023 04:03:08 +0100 Subject: [PATCH] doctor: delete action entries without existing user (#27292) just extend doctor with a usefully check :) Co-authored-by: techknowlogick --- modules/doctor/dbconsistency.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/doctor/dbconsistency.go b/modules/doctor/dbconsistency.go index a0637b8982..e5fc5785e8 100644 --- a/modules/doctor/dbconsistency.go +++ b/modules/doctor/dbconsistency.go @@ -189,6 +189,9 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er // find action without repository genericOrphanCheck("Action entries without existing repository", "action", "repository", "action.repo_id=repository.id"), + // find action without user + genericOrphanCheck("Action entries without existing user", + "action", "user", "action.act_user_id=`user`.id"), // find OAuth2Grant without existing user genericOrphanCheck("Orphaned OAuth2Grant without existing User", "oauth2_grant", "user", "oauth2_grant.user_id=`user`.id"),