summaryrefslogtreecommitdiffstats
path: root/modules/doctor
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-05-11 13:16:35 +0200
committerGitHub <noreply@github.com>2022-05-11 13:16:35 +0200
commitf41c2bec4ccadb0c147ca2588f4a00d60ae6c594 (patch)
tree4b8543a206a7fe23c518bc8f89f7f22b9f23dc4c /modules/doctor
parentcbd45471b1100bffcd2f18719b56a5da5468756b (diff)
downloadgitea-f41c2bec4ccadb0c147ca2588f4a00d60ae6c594.tar.gz
gitea-f41c2bec4ccadb0c147ca2588f4a00d60ae6c594.zip
Delete user related oauth stuff on user deletion too (#19677)
* delete user related oauth stuff on user deletion too * extend doctor check-db-consistency
Diffstat (limited to 'modules/doctor')
-rw-r--r--modules/doctor/dbconsistency.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/doctor/dbconsistency.go b/modules/doctor/dbconsistency.go
index 6b5755608b..9ab8feb679 100644
--- a/modules/doctor/dbconsistency.go
+++ b/modules/doctor/dbconsistency.go
@@ -186,6 +186,15 @@ 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 OAuth2Grant without existing user
+ genericOrphanCheck("Orphaned OAuth2Grant without existing User",
+ "oauth2_grant", "user", "oauth2_grant.user_id=user.id"),
+ // find OAuth2Application without existing user
+ genericOrphanCheck("Orphaned OAuth2Application without existing User",
+ "oauth2_application", "user", "oauth2_application.uid=user.id"),
+ // find OAuth2AuthorizationCode without existing OAuth2Grant
+ genericOrphanCheck("Orphaned OAuth2AuthorizationCode without existing OAuth2Grant",
+ "oauth2_authorization_code", "oauth2_grant", "oauth2_authorization_code.grant_id=oauth2_grant.id"),
)
for _, c := range consistencyChecks {