mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-1682] Removed MySql transaction from script because EF migration already wraps it under its own transaction
This commit is contained in:
@ -33,9 +33,7 @@
|
||||
`OU`.`Permissions` IS NOT NULL AND
|
||||
JSON_VALID(`OU`.`Permissions`) AND JSON_VALUE(`OU`.`Permissions`, '$.editAssignedCollections') = 'true'));
|
||||
|
||||
-- Start transaction
|
||||
START TRANSACTION;
|
||||
-- Step 1
|
||||
-- Step 1
|
||||
-- Update existing rows in `CollectionGroups`
|
||||
UPDATE `CollectionGroups` `CG`
|
||||
INNER JOIN `Collection` `C` ON `CG`.`CollectionId` = `C`.`Id`
|
||||
@ -58,7 +56,7 @@ START TRANSACTION;
|
||||
SET `AccessAll` = 0, `RevisionDate` = UTC_TIMESTAMP()
|
||||
WHERE `G`.`Id` IN (SELECT `GroupId` FROM `TempGroupsAccessAll`);
|
||||
|
||||
-- Step 2
|
||||
-- Step 2
|
||||
-- Update existing rows in `CollectionUsers`
|
||||
UPDATE `CollectionUsers` `target`
|
||||
INNER JOIN `Collection` `C` ON `target`.`CollectionId` = `C`.`Id`
|
||||
@ -82,7 +80,7 @@ START TRANSACTION;
|
||||
SET `AccessAll` = 0, `RevisionDate` = UTC_TIMESTAMP()
|
||||
WHERE `OU`.`Id` IN (SELECT `OrganizationUserId` FROM `TempUsersAccessAll`);
|
||||
|
||||
-- Step 3
|
||||
-- Step 3
|
||||
-- Update `CollectionUsers` with `Manage` = 1 using the temporary table
|
||||
UPDATE `CollectionUsers` `CU`
|
||||
INNER JOIN `TempUserManagers` `TUM` ON `CU`.`OrganizationUserId` = `TUM`.`OrganizationUserId`
|
||||
@ -108,7 +106,7 @@ START TRANSACTION;
|
||||
SET `OU`.`Type` = 2, `OU`.`RevisionDate` = UTC_TIMESTAMP() -- User
|
||||
WHERE `OU`.`Id` IN (SELECT `OrganizationUserId` FROM `TempUserManagers` WHERE `IsManager` = 1);
|
||||
|
||||
-- Step 4
|
||||
-- Step 4
|
||||
-- Update `User` `AccountRevisionDate` for each unique `OrganizationUserId`
|
||||
UPDATE `User` `U`
|
||||
INNER JOIN `OrganizationUser` `OU` ON `U`.`Id` = `OU`.`UserId`
|
||||
@ -132,15 +130,11 @@ START TRANSACTION;
|
||||
) AS `CombinedOrgUsers` ON `OU`.`Id` = `CombinedOrgUsers`.`OrganizationUserId`
|
||||
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`
|
||||
SET `FlexibleCollections` = 1
|
||||
WHERE `FlexibleCollections` = 0;
|
||||
|
||||
-- Commit transaction
|
||||
COMMIT;
|
||||
|
||||
-- Step 6: Drop the temporary tables
|
||||
DROP TEMPORARY TABLE IF EXISTS `TempGroupsAccessAll`;
|
||||
DROP TEMPORARY TABLE IF EXISTS `TempUsersAccessAll`;
|
||||
|
@ -123,8 +123,7 @@
|
||||
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"
|
||||
SET "FlexibleCollections" = true
|
||||
WHERE "FlexibleCollections" = false;
|
||||
|
@ -141,8 +141,7 @@
|
||||
) AS "CombinedOrgUsers" ON "OU"."Id" = "CombinedOrgUsers"."OrganizationUserId"
|
||||
);
|
||||
|
||||
-- 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"
|
||||
SET "FlexibleCollections" = 1
|
||||
WHERE "FlexibleCollections" = 0;
|
||||
|
Reference in New Issue
Block a user