Users::MigrateRecordsToGhostUserInBatchesWorker exception due to workspace record with PAT
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary <!-- Summarize the bug encountered concisely. --> 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: - https://gitlab.com/gitlab-org/gitlab/-/issues/520439+ - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129688+ ### Steps to reproduce <!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. --> - [Create a workspace](https://docs.gitlab.com/user/workspace/configuration/#create-a-workspace) - Attempt to delete the user ### What is the current *bug* behavior? <!-- Describe what actually happens. --> - The user is never deleted because the worker runs into an exception ### What is the expected *correct* behavior? <!-- Describe what you should see instead. --> - The user is deleted because any records are handled as expected ### Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> - https://log.gprd.gitlab.net/app/r/s/jBnqy - https://new-sentry.gitlab.net/organizations/gitlab/issues/1628181/?project=3 <!-- If you don't have /label privileges, follow up with an issue comment of `@gitlab-bot label ~"type::bug"` -->
issue