Skip to content

Commit dd1ed35

Browse files
zeripathlunny
andauthored
Add dbconsistency checks for Stopwatches (#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 fd0d481 commit dd1ed35

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/doctor/dbconsistency.go

+6
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)