Browse Source

update UserCipherDetails TVF and migration file

PM-27886
jaasen-livefront 1 month ago
parent
commit
6a09715158
No known key found for this signature in database
  1. 8
      src/Sql/dbo/Vault/Functions/UserCipherDetails.sql
  2. 9
      util/Migrator/DbScripts/2025-11-14_00_AddArchiveCipherToCipherDetails.sql

8
src/Sql/dbo/Vault/Functions/UserCipherDetails.sql

@ -23,7 +23,7 @@ SELECT
C.Favorite, C.Favorite,
C.FolderId, C.FolderId,
C.DeletedDate, C.DeletedDate,
C.ArchivedDate, CA.ArchivedDate,
C.Reprompt, C.Reprompt,
C.[Key], C.[Key],
CASE CASE
@ -62,6 +62,8 @@ LEFT JOIN
[dbo].[Group] G ON G.[Id] = GU.[GroupId] [dbo].[Group] G ON G.[Id] = GU.[GroupId]
LEFT JOIN LEFT JOIN
[dbo].[CollectionGroup] CG ON CG.[CollectionId] = CC.[CollectionId] AND CG.[GroupId] = GU.[GroupId] [dbo].[CollectionGroup] CG ON CG.[CollectionId] = CC.[CollectionId] AND CG.[GroupId] = GU.[GroupId]
LEFT JOIN
[dbo].[CipherArchive] CA ON CA.[CipherId] = C.[Id] AND CA.[UserId] = @UserId
WHERE WHERE
CU.[CollectionId] IS NOT NULL CU.[CollectionId] IS NOT NULL
OR CG.[CollectionId] IS NOT NULL OR CG.[CollectionId] IS NOT NULL
@ -80,7 +82,7 @@ SELECT
C.Favorite, C.Favorite,
C.FolderId, C.FolderId,
C.DeletedDate, C.DeletedDate,
C.ArchivedDate, CA.ArchivedDate,
C.Reprompt, C.Reprompt,
C.[Key], C.[Key],
1 [Edit], 1 [Edit],
@ -89,5 +91,7 @@ SELECT
0 [OrganizationUseTotp] 0 [OrganizationUseTotp]
FROM FROM
[dbo].[CipherDetails](@UserId) AS C [dbo].[CipherDetails](@UserId) AS C
LEFT JOIN
[dbo].[CipherArchive] CA ON CA.[CipherId] = C.[Id] AND CA.[UserId] = @UserId
WHERE WHERE
C.[UserId] = @UserId; C.[UserId] = @UserId;

9
util/Migrator/DbScripts/2025-11-14_00_AddArchiveCipherToCipherDetails.sql

@ -194,7 +194,7 @@ SELECT
C.Favorite, C.Favorite,
C.FolderId, C.FolderId,
C.DeletedDate, C.DeletedDate,
C.ArchivedDate, CA.ArchivedDate,
C.Reprompt, C.Reprompt,
C.[Key], C.[Key],
CASE CASE
@ -233,6 +233,8 @@ LEFT JOIN
[dbo].[Group] G ON G.[Id] = GU.[GroupId] [dbo].[Group] G ON G.[Id] = GU.[GroupId]
LEFT JOIN LEFT JOIN
[dbo].[CollectionGroup] CG ON CG.[CollectionId] = CC.[CollectionId] AND CG.[GroupId] = GU.[GroupId] [dbo].[CollectionGroup] CG ON CG.[CollectionId] = CC.[CollectionId] AND CG.[GroupId] = GU.[GroupId]
LEFT JOIN
[dbo].[CipherArchive] CA ON CA.[CipherId] = C.[Id] AND CA.[UserId] = @UserId
WHERE WHERE
CU.[CollectionId] IS NOT NULL CU.[CollectionId] IS NOT NULL
OR CG.[CollectionId] IS NOT NULL OR CG.[CollectionId] IS NOT NULL
@ -251,7 +253,7 @@ SELECT
C.Favorite, C.Favorite,
C.FolderId, C.FolderId,
C.DeletedDate, C.DeletedDate,
C.ArchivedDate, CA.ArchivedDate,
C.Reprompt, C.Reprompt,
C.[Key], C.[Key],
1 [Edit], 1 [Edit],
@ -260,6 +262,7 @@ SELECT
0 [OrganizationUseTotp] 0 [OrganizationUseTotp]
FROM FROM
[dbo].[CipherDetails](@UserId) AS C [dbo].[CipherDetails](@UserId) AS C
LEFT JOIN
[dbo].[CipherArchive] CA ON CA.[CipherId] = C.[Id] AND CA.[UserId] = @UserId
WHERE WHERE
C.[UserId] = @UserId; C.[UserId] = @UserId;
GO

Loading…
Cancel
Save