mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
[AC-1682] Update data migration script to only enable collection enhancements for organizations that have not yet migrated
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
-- This script will enable collection enhancements for all organizations.
|
||||
-- This script will enable collection enhancements for all organizations that have not yet migrated.
|
||||
|
||||
-- Step 1: Insert into a temporary table with an additional column for batch processing, update 50 k at a time
|
||||
SELECT [Id] AS [OrganizationId], CAST(ROW_NUMBER() OVER(ORDER BY [Id]) / 50000 AS INT) AS Batch
|
||||
INTO #TempOrg
|
||||
FROM [dbo].[Organization];
|
||||
-- WHERE [FlexibleCollections] = 0;
|
||||
FROM [dbo].[Organization]
|
||||
WHERE [FlexibleCollections] = 0;
|
||||
|
||||
-- Step 2: Get the maximum batch number
|
||||
DECLARE @MaxBatch INT = (SELECT MAX(Batch) FROM #TempOrg);
|
||||
@ -25,7 +25,7 @@ BEGIN
|
||||
|
||||
FETCH NEXT FROM OrgCursor INTO @OrganizationId;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
WHILE (@@FETCH_STATUS = 0)
|
||||
BEGIN
|
||||
-- Execute the stored procedure for the current OrganizationId
|
||||
EXEC [dbo].[Organization_EnableCollectionEnhancements] @OrganizationId;
|
||||
|
Reference in New Issue
Block a user