doc/development/deleting_data.md
In order to minimize the risk of accidental data loss, GitLab provides guidelines for how to safely use deletion operations in the codebase.
Generally, there are two ways to delete data:
Direct calls to hard delete classes should be avoided because it can lead to unintended data loss. Specifically, avoid invoking the following classes:
Projects::DestroyServiceProjectDestroyWorkerGroups::DestroyServiceGroupDestroyWorkerInstead of using Projects::DestroyService, use Projects::MarkForDeletionService.
Projects::MarkForDeletionService.new(project, current_user).execute
Instead of using Groups::DestroyService, use Groups::MarkForDeletionService.
Groups::MarkForDeletionService.new(group, current_user).execute