1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-17 15:08:27 +00:00

Delete user related oauth stuff on user deletion too (#19677) (#19680)

Backport (#19677)

* delete user related oauth stuff on user deletion too

* extend doctor check-db-consistency

* make it build for v1.16.x
This commit is contained in:
6543
2022-05-12 13:32:48 +02:00
committed by GitHub
parent 4386eb751f
commit 8f44d00f22
2 changed files with 17 additions and 0 deletions

View File

@@ -186,6 +186,15 @@ func checkDBConsistency(logger log.Logger, autofix bool) error {
// 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 {