Files
tenant-registry/migrations/0016_api_keys_active_name_unique.up.sql
sharang 5b4590d3bc
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m10s
ci / image (push) Successful in 36s
feat(api-keys): CI licences by API key and integration keys (#71)
2026-10-13 22:12:05 +00:00

5 lines
329 B
SQL

-- A key name is unique among a tenant's ACTIVE keys only, so a revoked key's
-- name can be reused (re-issuing an integration key = revoke, then create).
ALTER TABLE api_keys DROP CONSTRAINT api_keys_tenant_id_name_key;
CREATE UNIQUE INDEX api_keys_tenant_name_active_idx ON api_keys (tenant_id, name) WHERE revoked_at IS NULL;