1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-30 13:33:24 +01:00
bitwarden-server/util/Migrator/DbScripts/2023-04-26_01_FixOrganizationStatus.sql
Rui Tomé b02d86fad7
[PM-1974] Update the status of organizations from Pending to Created (#2886)
---------

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
2023-04-27 10:21:32 +10:00

18 lines
545 B
Transact-SQL

-- Update the [Status] of organizations from Pending (0) to Created (1) if they have at least 1 confirmed user
-- This is to fix an issue where the default value of 0 (Pending) was accidentally written back to the database
-- for existing organizations
UPDATE
[dbo].[Organization]
SET
[Status] = 1 -- Created
WHERE
[Status] = 0 -- Pending
AND [Id] IN (
SELECT DISTINCT
ou.[OrganizationId]
FROM
[dbo].OrganizationUser ou
WHERE
ou.[Status] = 2 -- confirmed
)
GO