Fix handling of resource iteration events when deleting a User

Merged Brett Walker requested to merge 349411-migrate-resource-iteration-event-to-ghost-user into master

What does this MR do and why?

Because of a NOT NULL constraint on the user_id in the resource_iteration_events table, a user could not be deleted.

We normally migrate dependent records to a ghost user, except when doing a hard delete. In the case of resource_iteration_events, there is identifying information that would require specific deletion of the resource_iteration_event record. So in this case, we will always set it to the ghost user.

How to set up and validate locally

  1. Login as a user, go to an issue and assign it's "Iteration" to something. This creates the record that caused the problem.
  2. Login as an admin, and delete the user. It should delete successfully.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #349411 (closed)

Edited by Alexandru Croitor