fix: allow tenant slug reuse after soft-delete
All checks were successful
CI / build (push) Successful in 1m24s
CI / docker (push) Successful in 44s

Replace absolute UNIQUE constraint on tenants.slug with a partial unique
index that excludes DELETED rows. This allows re-creating a tenant with
the same slug after deletion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-12 13:39:13 +02:00
parent 35a62463b3
commit 879accfc7f

View File

@@ -0,0 +1,5 @@
-- Replace absolute unique constraint on slug with partial unique index
-- that excludes DELETED tenants, allowing slug reuse after soft-delete.
ALTER TABLE tenants DROP CONSTRAINT tenants_slug_key;
DROP INDEX IF EXISTS idx_tenants_slug;
CREATE UNIQUE INDEX tenants_slug_active_key ON tenants (slug) WHERE status != 'DELETED';