Skip to content

Commit 14b597e

Browse files
zeripathlunny
authored and
Sysoev, Vladimir
committed
Add dbconsistency checks for Stopwatches (go-gitea#20010)
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]>
1 parent 3b6e34e commit 14b597e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/doctor/dbconsistency.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er
199199
// find OAuth2AuthorizationCode without existing OAuth2Grant
200200
genericOrphanCheck("Orphaned OAuth2AuthorizationCode without existing OAuth2Grant",
201201
"oauth2_authorization_code", "oauth2_grant", "oauth2_authorization_code.grant_id=oauth2_grant.id"),
202+
// find stopwatches without existing user
203+
genericOrphanCheck("Orphaned Stopwatches without existing User",
204+
"stopwatch", "user", "stopwatch.user_id=user.id"),
205+
// find stopwatches without existing issue
206+
genericOrphanCheck("Orphaned Stopwatches without existing Issue",
207+
"stopwatch", "issue", "stopwatch.issue_id=issue.id"),
202208
)
203209

204210
for _, c := range consistencyChecks {

0 commit comments

Comments
 (0)