In migrations/000_baseline.sql, tickets.created_by/updated_by/assigned_to, ticket_attachments.uploaded_by, ticket_dependencies.created_by, recurring_tickets.created_by/assigned_to, and api_keys.created_by all use ON DELETE SET NULL. But bulk_operations.performed_by (~line 72) and ticket_templates.created_by (~line 241) have no ON DELETE clause, which defaults to RESTRICT.
Impact: Deleting a user who ever ran a bulk operation or created a template will hard-fail at the DB level instead of nulling out the reference, breaking the pattern used everywhere else in the schema and potentially blocking legitimate user offboarding/cleanup.
Fix: Add a migration to change both FKs to ON DELETE SET NULL, matching the rest of the schema.
**Severity:** Medium
In `migrations/000_baseline.sql`, `tickets.created_by/updated_by/assigned_to`, `ticket_attachments.uploaded_by`, `ticket_dependencies.created_by`, `recurring_tickets.created_by/assigned_to`, and `api_keys.created_by` all use `ON DELETE SET NULL`. But `bulk_operations.performed_by` (~line 72) and `ticket_templates.created_by` (~line 241) have no `ON DELETE` clause, which defaults to `RESTRICT`.
**Impact:** Deleting a user who ever ran a bulk operation or created a template will hard-fail at the DB level instead of nulling out the reference, breaking the pattern used everywhere else in the schema and potentially blocking legitimate user offboarding/cleanup.
**Fix:** Add a migration to change both FKs to `ON DELETE SET NULL`, matching the rest of the schema.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: Medium
In
migrations/000_baseline.sql,tickets.created_by/updated_by/assigned_to,ticket_attachments.uploaded_by,ticket_dependencies.created_by,recurring_tickets.created_by/assigned_to, andapi_keys.created_byall useON DELETE SET NULL. Butbulk_operations.performed_by(~line 72) andticket_templates.created_by(~line 241) have noON DELETEclause, which defaults toRESTRICT.Impact: Deleting a user who ever ran a bulk operation or created a template will hard-fail at the DB level instead of nulling out the reference, breaking the pattern used everywhere else in the schema and potentially blocking legitimate user offboarding/cleanup.
Fix: Add a migration to change both FKs to
ON DELETE SET NULL, matching the rest of the schema.