1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-19 08:30:59 -05:00

[AC-1682] Bumped up the dates on the migration scripts

This commit is contained in:
Rui Tome
2024-01-12 12:54:34 +00:00
parent 5c08d181a4
commit 19fb7e583e
40 changed files with 7988 additions and 145 deletions

View File

@ -0,0 +1,21 @@
-- Update existing rows in CollectionUsers
UPDATE CollectionUsers AS target
INNER JOIN Collection AS C ON target.CollectionId = C.Id
INNER JOIN OrganizationUser AS OU ON C.OrganizationId = OU.OrganizationId
SET
target.ReadOnly = 0,
target.HidePasswords = 0,
target.Manage = 0
WHERE OU.AccessAll = 1;
-- Insert new rows into CollectionUsers
INSERT INTO CollectionUsers (CollectionId, OrganizationUserId, ReadOnly, HidePasswords, Manage)
SELECT C.Id AS CollectionId, OU.Id AS OrganizationUserId, 0, 0, 0
FROM Collection AS C
INNER JOIN OrganizationUser AS OU ON C.OrganizationId = OU.OrganizationId
WHERE OU.AccessAll = 1
AND NOT EXISTS (
SELECT 1
FROM CollectionUsers AS CU
WHERE CU.CollectionId = C.Id AND CU.OrganizationUserId = OU.Id
);