BE: Delete status

We cannot delete statuses, so we'll use a soft delete approach, like in ee/app/models/issuables/custom_field.rb:40 with a archived_at field.

Probably also do the same for lifecycle.

Update: As part of Iteration 2, the team has decided that we'll only allow the deletion of custom statuses that are not in use.

We will prevent the deletion of a custom status in the following cases:

  1. The status is in use (i.e., explicitly assigned to a work item).
  2. The status is set as one of the lifecycle's default statuses (e.g., open, closed, duplicated).
  3. The status was created as part of the transition from system-defined to custom statuses and has an associated status mapping. Every time the switch happens, we copy all 5 system-defined statuses into custom statuses. These mapped statuses (To do, In progress, Done, Won’t do, Duplicate) can still be updated but not deleted.

The statuses will be hard-deleted instead of soft-deleted (archived).

The deletion of statuses will be handled via the lifecycleUpdate mutation introduced in Add GraphQL mutation for updating custom lifecy... (!192988 - merged) and Adjust lifecycleUpdate mutation to prevent remo... (!194548 - merged).

Edited by Agnes Slota