I agree with @dkayiwa. I think it’s generally expected that names will be unique, though because it has been sporadically enforced it’s known that this can’t be universally relied upon. I’d assume we should keep names unique and that further constraints may be added to enforce this in a later release. For your use case, your best options are probably either migrate to a new uuid or rename the existing encounter type by appending " -v1" or “-retired” or something to the name.
I agree that the name should be unique among all non-retired entities. But wouldn’t expect the uniqueness constraint to lookup even in the retired ones.
In my opinion the natural behavior is one similar to Concepts, where the FSN is a unique key, only among non-retired concepts.
It’s nice to have db level constraints to help enforce data integrity. Combining name & retired into uniqueness, though you could have obscure errors trying to retire a resource that’s name matches a previously retired resource. And what happens if you try to retire a resource with a name previously used and retired?
How about keeping name uniqueness in the db and have the API help by adding “ (retired)” or “(retired #2)” to the name when retiring and removing it (adding a number if needed for uniqueness) when unretiring?