1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 05:00:19 -05:00

Update SQL files to be backwards compatible when adding columns (#1635)

* Update SQL files to be backwards compatible when adding columns

* Remove 'UseResetPasswordCustomOrg' SQL script
This commit is contained in:
Vince Grassia 2021-10-15 12:28:21 -04:00 committed by GitHub
parent 4d6b0c9106
commit 15eeb9d650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 6 deletions

View File

@ -11,6 +11,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[UsersGetPremium] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END) [UsersGetPremium] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
WHERE
[UsersGetPremium] IS NULL
GO GO
UPDATE UPDATE

View File

@ -11,6 +11,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[UseEvents] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END) [UseEvents] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
WHERE
[UseEvents] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -11,6 +11,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[Use2fa] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END) [Use2fa] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
WHERE
[Use2fa] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -50,6 +50,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[UseApi] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END) [UseApi] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
WHERE
[UseApi] IS NULL
GO GO
ALTER TABLE ALTER TABLE
@ -71,6 +73,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[ApiKey] = (SELECT [dbo].[SecureRandomString]()) [ApiKey] = (SELECT [dbo].[SecureRandomString]())
WHERE
[ApiKey] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -294,6 +294,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[UsePolicies] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END) [UsePolicies] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
WHERE
[UsePolicies] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -69,6 +69,8 @@ UPDATE
[dbo].[CollectionGroup] [dbo].[CollectionGroup]
SET SET
[HidePasswords] = 0 [HidePasswords] = 0
WHERE
[HidePasswords] IS NULL
GO GO
ALTER TABLE ALTER TABLE
@ -90,6 +92,8 @@ UPDATE
[dbo].[CollectionUser] [dbo].[CollectionUser]
SET SET
[HidePasswords] = 0 [HidePasswords] = 0
WHERE
[HidePasswords] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -11,6 +11,8 @@ UPDATE
[dbo].[Organization] [dbo].[Organization]
SET SET
[UseSso] = (CASE WHEN [PlanType] = 10 OR [PlanType] = 11 THEN 1 ELSE 0 END) [UseSso] = (CASE WHEN [PlanType] = 10 OR [PlanType] = 11 THEN 1 ELSE 0 END)
WHERE
[UseSso] IS NULL
GO GO
ALTER TABLE ALTER TABLE

View File

@ -1,6 +0,0 @@
-- For Enterprise (annual/monthly) and Custom (internal) orgs, enable potential use of UseResetPassword
UPDATE
[dbo].[Organization]
SET
[UseResetPassword] = (CASE WHEN [PlanType] IN (10, 11, 6) THEN 1 ELSE [UseResetPassword] END)
GO