Closed
Description
OS Information
- OS: Linux
- Architecture: amd64
coder --version
: Coder v0.0.0-devel+c034e83 Wed May 18 23:15:19 UTC 2022
c034e83
Steps to Reproduce
- create a template from an example like
gcp-linux
- delete it with
coder templates delete gcp-linux
- recreate the same template with the same name
status code 500: execute transaction: insert template: pq: duplicate key value violates unique constraint "templates_organization_id_name_key"
Expected
You should be able to recreate templates
Actual
We are not clearing columns that have unique constraints, so you can't create a template with the same name twice in the same org.
Logs
Screenshot
Notes
In v1 we resolved this problem when we soft-deleted users by randomizing all of the unique fields (i.e. setting to a random UUID). Seems like this could be solved by renaming the template to a new UUID on deletion.