1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

Remove indexing from data migration (#3247)

This commit is contained in:
Thomas Avery 2023-09-07 11:33:46 -05:00 committed by GitHub
parent 721c18e94a
commit b8b2efa767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,14 +6,6 @@ The final migration is in util/Migrator/DbScripts/2023-08-10_01_RemoveClientSecr
IF COL_LENGTH('[dbo].[ApiKey]', 'ClientSecretHash') IS NOT NULL AND COL_LENGTH('[dbo].[ApiKey]', 'ClientSecret') IS NOT NULL IF COL_LENGTH('[dbo].[ApiKey]', 'ClientSecretHash') IS NOT NULL AND COL_LENGTH('[dbo].[ApiKey]', 'ClientSecret') IS NOT NULL
BEGIN BEGIN
-- Add index
IF NOT EXISTS(SELECT name FROM sys.indexes WHERE name = 'IX_ApiKey_ClientSecretHash')
BEGIN
CREATE NONCLUSTERED INDEX [IX_ApiKey_ClientSecretHash]
ON [dbo].[ApiKey]([ClientSecretHash] ASC)
WITH (ONLINE = ON)
END
-- Data Migration -- Data Migration
DECLARE @BatchSize INT = 10000 DECLARE @BatchSize INT = 10000
WHILE @BatchSize > 0 WHILE @BatchSize > 0
@ -34,9 +26,5 @@ BEGIN
COMMIT TRANSACTION Migrate_ClientSecretHash COMMIT TRANSACTION Migrate_ClientSecretHash
END END
-- Drop index
DROP INDEX IF EXISTS [IX_ApiKey_ClientSecretHash]
ON [dbo].[ApiKey];
END END
GO GO