1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

[AC-1682] Reverted scripts back to enabling Flexible Collections to all existing Orgs

This commit is contained in:
Rui Tome
2024-04-03 11:25:03 +01:00
parent f98646a722
commit bd3b21b969
3 changed files with 12 additions and 50 deletions

View File

@ -123,31 +123,20 @@
SELECT "OrganizationUserId"
FROM "GroupUser"
WHERE "GroupId" IN (SELECT "GroupId" FROM "TempGroupsAccessAll")
UNION
SELECT "OrganizationUserId" FROM "TempUsersAccessAll"
UNION
SELECT "OrganizationUserId" FROM "TempUserManagers"
);
-- Step 5: Set "FlexibleCollections" = true for all organizations that have not yet been migrated.
UPDATE "Organization" AS "O"
UPDATE "Organization"
SET "FlexibleCollections" = true
FROM (
SELECT DISTINCT "TG"."OrganizationId"
FROM "TempGroupsAccessAll" AS "TG"
UNION
SELECT DISTINCT "TU"."OrganizationId"
FROM "TempUsersAccessAll" AS "TU"
UNION
SELECT DISTINCT "OU"."OrganizationId"
FROM "TempUserManagers" AS "OU"
) AS "TempOrgIds"
WHERE "O"."Id" = "TempOrgIds"."OrganizationId"
AND "O"."FlexibleCollections" = false;
WHERE "FlexibleCollections" = false;
-- Step 6: Drop the temporary tables
DROP TABLE IF EXISTS "TempGroupsAccessAll";