Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
-- GroupUser duplicate/concurrency hardening.
|
||||
--
|
||||
-- Membership writes use createMany(skipDuplicates), which relies on a real
|
||||
-- user/group uniqueness constraint rather than application-side de-duping alone.
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM "GroupUser"
|
||||
GROUP BY "groupId", "userId"
|
||||
HAVING COUNT(*) > 1
|
||||
) THEN
|
||||
RAISE EXCEPTION 'Cannot add GroupUser membership uniqueness: duplicate groupId/userId rows exist';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "group_user_membership_key"
|
||||
ON "GroupUser" ("groupId", "userId");
|
||||
Reference in new issue
Block a user