1
0
mirror of https://github.com/bitwarden/server synced 2026-01-20 01:13:18 +00:00

SelectionReadOnly MERGE to CollectionGroup

This commit is contained in:
Kyle Spearrin
2017-05-11 11:41:13 -04:00
parent f0d7dc8023
commit 2b8db4d1ed
18 changed files with 129 additions and 73 deletions

View File

@@ -5,7 +5,7 @@
@AccessAll BIT,
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@CollectionIds AS [dbo].[GuidIdArray] READONLY
@Collections AS [dbo].[SelectionReadOnlyArray] READONLY
AS
BEGIN
SET NOCOUNT ON
@@ -23,7 +23,7 @@ BEGIN
MERGE
[dbo].[CollectionGroup] AS [Target]
USING
@CollectionIds AS [Source]
@Collections AS [Source]
ON
[Target].[CollectionId] = [Source].[Id]
AND [Target].[GroupId] = @Id
@@ -33,8 +33,10 @@ BEGIN
(
[Source].[Id],
@Id,
0
[Source].[ReadOnly]
)
WHEN MATCHED AND [Target].[ReadOnly] != [Source].[ReadOnly] THEN
UPDATE SET [Target].[ReadOnly] = [Source].[ReadOnly]
WHEN NOT MATCHED BY SOURCE
AND [Target].[GroupId] = @Id THEN
DELETE