Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -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");