mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-21 23:43:41 +00:00
1.3 KiB
1.3 KiB
stage, group, info, title
stage | group | info | title |
---|---|---|---|
none | unassigned | Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/development/development_processes/#development-guidelines-review. | Data deletion guidelines |
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:
- Mark for deletion: Identifies data for removal at a future date. This is the preferred approach.
- Hard deletion: Immediately and permanently removes data.
Avoid direct hard deletion
Direct calls to hard delete classes should be avoided because it can lead to unintended data loss. Specifically, avoid invoking the following classes:
Projects::DestroyService
ProjectDestroyWorker
Groups::DestroyService
GroupDestroyWorker
Recommended approach
For projects
Instead of using Projects::DestroyService
, use Projects::MarkForDeletionService
.
Projects::MarkForDeletionService.new(project, current_user).execute
For groups
Instead of using Groups::DestroyService
, use Groups::MarkForDeletionService
.
Groups::MarkForDeletionService.new(group, current_user).execute