1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

[EC-427] Changed migration script to include a default value constraint instead of updating the null type

This commit is contained in:
Rui Tome
2023-01-11 14:43:56 +00:00
parent a1c62222a7
commit 40fca094a2

View File

@ -4,20 +4,10 @@ BEGIN
ALTER TABLE
[dbo].[Provider]
ADD
[Type] TINYINT NULL
[Type] TINYINT NOT NULL CONSTRAINT DF_Provider_Type DEFAULT 0;
END
GO
-- Setting existing Providers Type = 0 (MSP)
UPDATE [dbo].[Provider]
SET [Type] = 0
WHERE [Type] is NULL
GO
-- Changing 'Type' column to not null
ALTER TABLE [dbo].[Provider] ALTER COLUMN [Type] TINYINT NOT NULL
GO
-- Add column 'BillingPhone' to 'Provider' table
IF COL_LENGTH('[dbo].[Provider]', 'BillingPhone') IS NULL
BEGIN