mirror of
https://github.com/bitwarden/server.git
synced 2025-02-01 23:31:41 +01:00
[AC-2323] Flexible collections: automatically migrate data for all Organizations (#3927)
* [AC-2323] Added script to migrate all sql organizations to use flexible collections * [AC-2323] Overriding FlexibleCollectionsSignup to true for local usage * [AC-2323] Fix script comment * [AC-2323] Fixed typo * [AC-2323] Bump up date on migration script * [AC-2323] Bump migration script date --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
parent
186afbc162
commit
d2abf5b2d7
@ -151,7 +151,8 @@ public static class FeatureFlagKeys
|
||||
{ TrustedDeviceEncryption, "true" },
|
||||
{ Fido2VaultCredentials, "true" },
|
||||
{ DuoRedirect, "true" },
|
||||
{ UnassignedItemsBanner, "true"}
|
||||
{ UnassignedItemsBanner, "true"},
|
||||
{ FlexibleCollectionsSignup, "true" }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
-- This script will enable collection enhancements for organizations that don't have Collection Enhancements enabled.
|
||||
|
||||
-- Step 1: Create a temporary table to store the Organizations with FlexibleCollections = 0
|
||||
SELECT [Id] AS [OrganizationId]
|
||||
INTO #TempOrg
|
||||
FROM [dbo].[Organization]
|
||||
WHERE [FlexibleCollections] = 0
|
||||
|
||||
-- Step 2: Execute the stored procedure for each OrganizationId
|
||||
DECLARE @OrganizationId UNIQUEIDENTIFIER;
|
||||
|
||||
DECLARE OrgCursor CURSOR FOR
|
||||
SELECT [OrganizationId]
|
||||
FROM #TempOrg;
|
||||
|
||||
OPEN OrgCursor;
|
||||
|
||||
FETCH NEXT FROM OrgCursor INTO @OrganizationId;
|
||||
|
||||
WHILE (@@FETCH_STATUS = 0)
|
||||
BEGIN
|
||||
-- Execute the stored procedure for the current OrganizationId
|
||||
EXEC [dbo].[Organization_EnableCollectionEnhancements] @OrganizationId;
|
||||
|
||||
-- Update the Organization to set FlexibleCollections = 1
|
||||
UPDATE [dbo].[Organization]
|
||||
SET [FlexibleCollections] = 1
|
||||
WHERE [Id] = @OrganizationId;
|
||||
|
||||
FETCH NEXT FROM OrgCursor INTO @OrganizationId;
|
||||
END;
|
||||
|
||||
CLOSE OrgCursor;
|
||||
DEALLOCATE OrgCursor;
|
||||
|
||||
-- Step 3: Drop the temporary table
|
||||
DROP TABLE #TempOrg;
|
Loading…
Reference in New Issue
Block a user