Delete associated records when user is deleted
What does this MR do and why?
This change adds new database relationships to track what happens when a user account is deleted from the system. Specifically, it defines how the system should handle lists, custom fields, custom lifecycles and custom statuses records that were created or updated by that user. When a user is deleted, some of their associated records (lists) will be completely removed, while others (custom fields, custom lifecycles and custom statuses they created or modified) will have their user reference cleared but the records themselves will remain in the system.
References
How to set up and validate locally
You can create a new user, and create a list in the issue board with this user as assignee. Once you delete the user, the list should also get deleted. Also if add the user_id in the created_by_id
or updated_by_id
in Issuables::CustomField
record, in WorkItems::Statuses::Custom::Lifecycle
record and in WorkItems::Statuses::Custom::Status
record it should nulify the columns once the user is deleted.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.