1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-27 13:05:23 +01:00

fix sproc

This commit is contained in:
Brandon 2024-11-20 14:15:39 -05:00
parent 8280929d64
commit 08ae01c4a9
No known key found for this signature in database
GPG Key ID: A0E0EF0B207BA40D

View File

@ -29,7 +29,7 @@ BEGIN
FROM FROM
[dbo].[Cipher] [dbo].[Cipher]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
SET @BatchSize = @@ROWCOUNT SET @BatchSize = @@ROWCOUNT
@ -43,28 +43,28 @@ BEGIN
FROM FROM
[dbo].[WebAuthnCredential] [dbo].[WebAuthnCredential]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete folders -- Delete folders
DELETE DELETE
FROM FROM
[dbo].[Folder] [dbo].[Folder]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete AuthRequest, must be before Device -- Delete AuthRequest, must be before Device
DELETE DELETE
FROM FROM
[dbo].[AuthRequest] [dbo].[AuthRequest]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete devices -- Delete devices
DELETE DELETE
FROM FROM
[dbo].[Device] [dbo].[Device]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete collection users -- Delete collection users
DELETE DELETE
@ -74,7 +74,7 @@ BEGIN
INNER JOIN INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = CU.[OrganizationUserId] [dbo].[OrganizationUser] OU ON OU.[Id] = CU.[OrganizationUserId]
WHERE WHERE
OU.[UserId] IN (@ParsedIds) OU.[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete group users -- Delete group users
DELETE DELETE
@ -84,7 +84,7 @@ BEGIN
INNER JOIN INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId] [dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId]
WHERE WHERE
OU.[UserId] IN (@ParsedIds) OU.[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete AccessPolicy -- Delete AccessPolicy
DELETE DELETE
@ -94,65 +94,65 @@ BEGIN
INNER JOIN INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = AP.[OrganizationUserId] [dbo].[OrganizationUser] OU ON OU.[Id] = AP.[OrganizationUserId]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete organization users -- Delete organization users
DELETE DELETE
FROM FROM
[dbo].[OrganizationUser] [dbo].[OrganizationUser]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete provider users -- Delete provider users
DELETE DELETE
FROM FROM
[dbo].[ProviderUser] [dbo].[ProviderUser]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete SSO Users -- Delete SSO Users
DELETE DELETE
FROM FROM
[dbo].[SsoUser] [dbo].[SsoUser]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Emergency Accesses -- Delete Emergency Accesses
DELETE DELETE
FROM FROM
[dbo].[EmergencyAccess] [dbo].[EmergencyAccess]
WHERE WHERE
[GrantorId] in (@ParsedIds) [GrantorId] IN (SELECT * FROM @ParsedIds)
OR OR
[GranteeId] in (@ParsedIds) [GranteeId] IN (SELECT * FROM @ParsedIds)
-- Delete Sends -- Delete Sends
DELETE DELETE
FROM FROM
[dbo].[Send] [dbo].[Send]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Notification Status -- Delete Notification Status
DELETE DELETE
FROM FROM
[dbo].[NotificationStatus] [dbo].[NotificationStatus]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Notification -- Delete Notification
DELETE DELETE
FROM FROM
[dbo].[Notification] [dbo].[Notification]
WHERE WHERE
[UserId] IN (@ParsedIds) [UserId] IN (SELECT * FROM @ParsedIds)
-- Finally, delete the user -- Finally, delete the user
DELETE DELETE
FROM FROM
[dbo].[User] [dbo].[User]
WHERE WHERE
[Id] in (@ParsedIds) [Id] IN (SELECT * FROM @ParsedIds)
COMMIT TRANSACTION User_DeleteById COMMIT TRANSACTION User_DeleteById
END END