User can't be hard deleted in some cases

reported in https://gitlab.com/gitlab-com/infrastructure/issues/4467

If a user has granted some OAuth permissions it can't be deleted later as the foreign key does not have ON DELETE constraint:

  add_foreign_key "oauth_openid_requests", "oauth_access_grants", column: "access_grant_id", name: "fk_oauth_openid_requests_oauth_access_grants_access_grant_id"

UPDATE:

I forgot to mention one important consequence of this bug. Although the user won't be deleted, all the owned projects and groups will be removed!

/cc @stanhu

Edited Jul 01, 2018 by Valery Sizov
Assignee Loading
Time tracking Loading