Store a history of states to transition back
Suppose we have a namespace that transitions from active -> archived -> deletion_scheduled -> deletion_in_progress.
If, for any reason, the deletion fails, the namespace is restored to deletion_scheduled. In this state, if the user restores the namespace, the namespace should transition back to archived and not active. For this reason, we would need to maintain a small history of states.
We can use namespace_details.state_metadata column to store this, as we don't need to store the full history and just a small number of the possible historical states where the namespace can be transitioned back.
Edited by Abdul Wadood