1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

doctor: delete action entries without existing user (#27292)

just extend doctor with a usefully check :)

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
This commit is contained in:
6543 2023-09-28 04:03:08 +01:00 committed by GitHub
parent 98f02203f9
commit 15fa0383fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,6 +189,9 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er
// find action without repository // find action without repository
genericOrphanCheck("Action entries without existing repository", genericOrphanCheck("Action entries without existing repository",
"action", "repository", "action.repo_id=repository.id"), "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 // find OAuth2Grant without existing user
genericOrphanCheck("Orphaned OAuth2Grant without existing User", genericOrphanCheck("Orphaned OAuth2Grant without existing User",
"oauth2_grant", "user", "oauth2_grant.user_id=`user`.id"), "oauth2_grant", "user", "oauth2_grant.user_id=`user`.id"),