Users::MigrateRecordsToGhostUserInBatchesWorker exception due to workspace record with PAT
Summary
User deletions fail because of workspace records that reference a personal access token that is being deleted, raising an exception.
ERROR: update or delete on table "personal_access_tokens" violates foreign key constraint "fk_ec70695b2c" on table "workspaces" (PG::ForeignKeyViolation)
DETAIL: Key (id)=(TOKEN_ID) is still referenced from table "workspaces".
Related:
- Discuss how we handle records with deleted user... (#520439)
- Add workspace variables table and add PAT to wo... (!129688 - merged)
Steps to reproduce
- Create a workspace
- Attempt to delete the user
What is the current bug behavior?
- The user is never deleted because the worker runs into an exception
What is the expected correct behavior?
- The user is deleted because any records are handled as expected
Relevant logs and/or screenshots
Edited by Jio Castillo