Skip to content

Commit

Permalink
Add dbconsistency checks for Stopwatches (go-gitea#20010)
Browse files Browse the repository at this point in the history
It appears possible that stopwatches can become orphaned or have been orphaned in
the past.

This PR adds Orphan checks for Stopwatches.

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
zeripath and lunny authored Jun 18, 2022
1 parent fd0d481 commit dd1ed35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/doctor/dbconsistency.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er
// find OAuth2AuthorizationCode without existing OAuth2Grant
genericOrphanCheck("Orphaned OAuth2AuthorizationCode without existing OAuth2Grant",
"oauth2_authorization_code", "oauth2_grant", "oauth2_authorization_code.grant_id=oauth2_grant.id"),
// find stopwatches without existing user
genericOrphanCheck("Orphaned Stopwatches without existing User",
"stopwatch", "user", "stopwatch.user_id=user.id"),
// find stopwatches without existing issue
genericOrphanCheck("Orphaned Stopwatches without existing Issue",
"stopwatch", "issue", "stopwatch.issue_id=issue.id"),
)

for _, c := range consistencyChecks {
Expand Down

0 comments on commit dd1ed35

Please sign in to comment.