mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
[AC-1682] Reverted scripts back to enabling Flexible Collections to all existing Orgs
This commit is contained in:
parent
f98646a722
commit
bd3b21b969
@ -133,23 +133,9 @@
|
|||||||
SET `U`.`AccountRevisionDate` = UTC_TIMESTAMP();
|
SET `U`.`AccountRevisionDate` = UTC_TIMESTAMP();
|
||||||
|
|
||||||
-- Step 5: Set `FlexibleCollections` = 1 for all organizations that have not yet been migrated.
|
-- Step 5: Set `FlexibleCollections` = 1 for all organizations that have not yet been migrated.
|
||||||
UPDATE `Organization` AS `O`
|
UPDATE `Organization`
|
||||||
JOIN (
|
SET `FlexibleCollections` = 1
|
||||||
SELECT DISTINCT `TG`.`OrganizationId`
|
WHERE `FlexibleCollections` = 0;
|
||||||
FROM `TempGroupsAccessAll` AS `TG`
|
|
||||||
|
|
||||||
UNION
|
|
||||||
|
|
||||||
SELECT DISTINCT `TU`.`OrganizationId`
|
|
||||||
FROM `TempUsersAccessAll` AS `TU`
|
|
||||||
|
|
||||||
UNION
|
|
||||||
|
|
||||||
SELECT DISTINCT `OU`.`OrganizationId`
|
|
||||||
FROM `TempUserManagers` AS `OU`
|
|
||||||
) AS `TempOrgIds` ON `O`.`Id` = `TempOrgIds`.`OrganizationId`
|
|
||||||
SET `O`.`FlexibleCollections` = 1
|
|
||||||
WHERE `O`.`FlexibleCollections` = 0;
|
|
||||||
|
|
||||||
-- Step 6: Drop the temporary tables
|
-- Step 6: Drop the temporary tables
|
||||||
DROP TEMPORARY TABLE IF EXISTS `TempGroupsAccessAll`;
|
DROP TEMPORARY TABLE IF EXISTS `TempGroupsAccessAll`;
|
||||||
|
@ -123,31 +123,20 @@
|
|||||||
SELECT "OrganizationUserId"
|
SELECT "OrganizationUserId"
|
||||||
FROM "GroupUser"
|
FROM "GroupUser"
|
||||||
WHERE "GroupId" IN (SELECT "GroupId" FROM "TempGroupsAccessAll")
|
WHERE "GroupId" IN (SELECT "GroupId" FROM "TempGroupsAccessAll")
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
SELECT "OrganizationUserId" FROM "TempUsersAccessAll"
|
SELECT "OrganizationUserId" FROM "TempUsersAccessAll"
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
SELECT "OrganizationUserId" FROM "TempUserManagers"
|
SELECT "OrganizationUserId" FROM "TempUserManagers"
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Step 5: Set "FlexibleCollections" = true for all organizations that have not yet been migrated.
|
-- Step 5: Set "FlexibleCollections" = true for all organizations that have not yet been migrated.
|
||||||
UPDATE "Organization" AS "O"
|
UPDATE "Organization"
|
||||||
SET "FlexibleCollections" = true
|
SET "FlexibleCollections" = true
|
||||||
FROM (
|
WHERE "FlexibleCollections" = false;
|
||||||
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;
|
|
||||||
|
|
||||||
-- Step 6: Drop the temporary tables
|
-- Step 6: Drop the temporary tables
|
||||||
DROP TABLE IF EXISTS "TempGroupsAccessAll";
|
DROP TABLE IF EXISTS "TempGroupsAccessAll";
|
||||||
|
@ -123,11 +123,11 @@
|
|||||||
WHERE "Id" IN (
|
WHERE "Id" IN (
|
||||||
SELECT DISTINCT "OU"."UserId"
|
SELECT DISTINCT "OU"."UserId"
|
||||||
FROM "OrganizationUser" "OU"
|
FROM "OrganizationUser" "OU"
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
-- Step 1
|
-- Step 1
|
||||||
SELECT "GU"."OrganizationUserId"
|
SELECT "GU"."OrganizationUserId"
|
||||||
FROM "GroupUser" "GU"
|
FROM "GroupUser" "GU"
|
||||||
INNER JOIN "TempGroupsAccessAll" "TG" ON "GU"."GroupId" = "TG"."GroupId"
|
INNER JOIN "TempGroupsAccessAll" "TG" ON "GU"."GroupId" = "TG"."GroupId"
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
@ -146,20 +146,7 @@
|
|||||||
-- Step 5: Set "FlexibleCollections" = 1 for all organizations that have not yet been migrated.
|
-- Step 5: Set "FlexibleCollections" = 1 for all organizations that have not yet been migrated.
|
||||||
UPDATE "Organization"
|
UPDATE "Organization"
|
||||||
SET "FlexibleCollections" = 1
|
SET "FlexibleCollections" = 1
|
||||||
WHERE "Id" IN (
|
WHERE "FlexibleCollections" = 0;
|
||||||
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"
|
|
||||||
) AND "FlexibleCollections" = 0;
|
|
||||||
|
|
||||||
-- Step 6: Drop the temporary tables
|
-- Step 6: Drop the temporary tables
|
||||||
DROP TABLE IF EXISTS "TempGroupsAccessAll";
|
DROP TABLE IF EXISTS "TempGroupsAccessAll";
|
||||||
|
Loading…
Reference in New Issue
Block a user