From a31c231749282c4e1b442de45c1edaa8dae8e502 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 3 Aug 2021 15:54:47 -0400 Subject: [PATCH] Fix UserKdf and UserApiKey migrations to only update null values (#1494) --- util/Migrator/DbScripts/2018-08-14_00_UserKdf.sql | 4 ++++ util/Migrator/DbScripts/2020-10-28_00_UserApiKey.sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/util/Migrator/DbScripts/2018-08-14_00_UserKdf.sql b/util/Migrator/DbScripts/2018-08-14_00_UserKdf.sql index 16ec439037..407094c049 100644 --- a/util/Migrator/DbScripts/2018-08-14_00_UserKdf.sql +++ b/util/Migrator/DbScripts/2018-08-14_00_UserKdf.sql @@ -13,6 +13,10 @@ UPDATE SET [Kdf] = 0, [KdfIterations] = 5000 +WHERE + [Kdf] IS NULL +OR + [KdfIterations] IS NULL GO ALTER TABLE diff --git a/util/Migrator/DbScripts/2020-10-28_00_UserApiKey.sql b/util/Migrator/DbScripts/2020-10-28_00_UserApiKey.sql index c712e7cac5..0b88706613 100644 --- a/util/Migrator/DbScripts/2020-10-28_00_UserApiKey.sql +++ b/util/Migrator/DbScripts/2020-10-28_00_UserApiKey.sql @@ -51,6 +51,8 @@ UPDATE [dbo].[User] SET [ApiKey] = (SELECT [dbo].[SecureRandomString]()) +WHERE + [ApiKey] IS NULL GO -- Change dbo.User.ApiKey to not null to enforece all future users to have one on create