From 502d2bf91e966d9ff68c79614287073e9cd2a7f4 Mon Sep 17 00:00:00 2001 From: Rahmat Hidayat Date: Mon, 16 Oct 2023 13:38:52 +0700 Subject: [PATCH] fix: add `resource_id` to grant unique index (#96) --- .../migrations/000017_create_grant_unique_index.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/store/postgres/migrations/000017_create_grant_unique_index.up.sql b/internal/store/postgres/migrations/000017_create_grant_unique_index.up.sql index 398112dbb..317a7214b 100644 --- a/internal/store/postgres/migrations/000017_create_grant_unique_index.up.sql +++ b/internal/store/postgres/migrations/000017_create_grant_unique_index.up.sql @@ -1,3 +1,3 @@ -CREATE UNIQUE INDEX IF NOT EXISTS "unique_active_grants_index" ON "grants" ("account_id", "account_type", "permissions") +CREATE UNIQUE INDEX IF NOT EXISTS "unique_active_grants_index" ON "grants" ("account_id", "account_type", "resource_id", "permissions") WHERE - "status" = 'active'; \ No newline at end of file + "status" = 'active';