Rename deletion_scheduled state to soft_deleted
Context
In https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/lifecycle/ we propose to use soft-deleted instead of marked for deletion.
This issue is to perform the rename.
Proposal
In app/models/concerns/gitlab/tenant_container_lifecycle/stateful/transition_callbacks.rb:
- Copy the
set_deletion_schedule_dataandclear_deletion_schedule_datamethods toapp/models/concerns/organizations/stateful.rb
In app/models/concerns/organizations/stateful.rb:
- Rename the
deletion_scheduledstate tosoft_deleted - Replace
schedule_deletionwithsoft_delete - Replace
set_deletion_schedule_datawithset_soft_deletion_data - Replace
clear_deletion_schedule_datawithclear_soft_deletion_data - Replace
deletion_scheduled_atwithsoft_deleted_at - Replace
start_deletionwithhard_delete - Replace
cancel_deletionwithrestore - Remove the
reschedule_deletionevent
In app/models/organizations/organization_detail.rb:
- Rename
deletion_scheduled_by_user_idtosoft_deletion_scheduled_by_user_id - Rename
deletion_errortohard_deletion_error
In app/validators/json_schemas/organization_detail_state_metadata.json:
- Make the relevant updates.
Rename app/services/organizations/mark_for_deletion_service.rb to app/services/organizations/soft_deletion_service.rb and update the file and callers accordingly to replace MarkForDeletionService with SoftDeletionService.
In app/services/organizations/soft_deletion_service.rb:
- Replace
schedule_deletionwithsoft_delete. - Replace
deletion_scheduled?withsoft_deleted?. - In
#execute, replace "marked for deletion" with "deleted" (not using "soft deleted" since from the end-user perspective, the organization is actually deleted). - In
#log_event, replace "Organization marked for deletion" with "Organization soft deleted" (since this is internal log event, we should state that the organization is soft deleted)
Follow https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/#renaming-columns to rename the deletion_scheduled_at column to soft_deleted_at.
Update specs accordingly.
Out of scope
- Leave
set_deletion_schedule_dataandclear_deletion_schedule_datamethods inapp/models/concerns/gitlab/tenant_container_lifecycle/stateful/transition_callbacks.rbsince they're still used byNamespaces::Stateful. - New services or API endpoints — this is a state-machine-only change.