Cascade PAT deletion on user deletion
Occasionally a GitLab admin has reason to delete a user using the API, but cannot do this if there are extant personal access tokens for that user due to a foreign key constraint, e.g.:
ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "users" violates foreign key constraint "fk_rails_08903b8f38" on table "personal_access_tokens")
DETAIL: Key (id)=(12345678) is still referenced from table "personal_access_tokens".
I may well be missing context, but I'm not sure why we'd avoid cascading PAT deletion when we're deleting the user they belong to. It seems like an oversight to me.
Let me know what you think, I'm happy to MR this but wanted to be sure it was on the right track before fiddling with rails