1
0
mirror of https://github.com/bitwarden/server synced 2025-12-25 20:53:16 +00:00

fix migration

This commit is contained in:
jaasen-livefront
2025-11-17 15:55:29 -08:00
parent dfb5312bc2
commit 806ccb195f

View File

@@ -309,3 +309,60 @@ FROM
WHERE
C.[UserId] = @UserId;
GO
IF OBJECT_ID('[dbo].[CipherDetails_ReadByIdUserId]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[CipherDetails_ReadByIdUserId];
END
GO
CREATE PROCEDURE [dbo].[CipherDetails_ReadByIdUserId]
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON;
SELECT
ucd.Id,
ucd.UserId,
ucd.OrganizationId,
ucd.Type,
ucd.Data,
ucd.Attachments,
ucd.CreationDate,
ucd.RevisionDate,
ucd.Favorite,
ucd.FolderId,
ucd.DeletedDate,
ucd.Reprompt,
ucd.[Key],
ucd.OrganizationUseTotp,
MAX(ca.ArchivedDate) AS ArchivedDate,
MAX(ucd.Edit) AS Edit,
MAX(ucd.ViewPassword) AS ViewPassword,
MAX(ucd.Manage) AS Manage
FROM
[dbo].[UserCipherDetails](@UserId) AS ucd
LEFT JOIN [dbo].[CipherArchive] AS ca
ON ca.CipherId = ucd.Id
AND ca.UserId = @UserId
WHERE
ucd.Id = @Id
GROUP BY
ucd.Id,
ucd.UserId,
ucd.OrganizationId,
ucd.Type,
ucd.Data,
ucd.Attachments,
ucd.CreationDate,
ucd.RevisionDate,
ucd.Favorite,
ucd.FolderId,
ucd.DeletedDate,
ucd.Reprompt,
ucd.[Key],
ucd.OrganizationUseTotp;
END
GO