From 04253d9bca651b9cf4023ac51a621aaa720bda2f Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Mon, 20 Nov 2023 12:36:02 -0500 Subject: [PATCH] SM-1010: Turn off secrets manager beta with a new migration (#3451) --- .../2023-11-15_00_TurnOffSecretsManagerBeta.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 util/Migrator/DbScripts/2023-11-15_00_TurnOffSecretsManagerBeta.sql diff --git a/util/Migrator/DbScripts/2023-11-15_00_TurnOffSecretsManagerBeta.sql b/util/Migrator/DbScripts/2023-11-15_00_TurnOffSecretsManagerBeta.sql new file mode 100644 index 0000000000..b242d977b6 --- /dev/null +++ b/util/Migrator/DbScripts/2023-11-15_00_TurnOffSecretsManagerBeta.sql @@ -0,0 +1,16 @@ +IF COL_LENGTH('[dbo].[Organization]', 'SecretsManagerBeta') IS NOT NULL +BEGIN + -- Set AccessSecretsManager to 0 for Organization Users in SM Beta orgs + UPDATE [dbo].[OrganizationUser] + SET AccessSecretsManager = 0 + FROM [dbo].[OrganizationUser] AS ou + INNER JOIN [dbo].[Organization] AS o ON ou.OrganizationId = o.Id + WHERE o.SecretsManagerBeta = 1 AND ou.AccessSecretsManager = 1 + + -- Set UseSecretsManager and SecretsManagerBeta to 0 for Organizations in SM Beta + UPDATE [dbo].[Organization] + SET UseSecretsManager = 0, SecretsManagerBeta = 0 + FROM [dbo].[Organization] AS o + WHERE o.SecretsManagerBeta = 1 +END +GO