mirror of
https://github.com/bitwarden/server.git
synced 2024-12-23 17:07:42 +01:00
delete non-folders and then folders to avoid FK constraint issues when batch deleting
This commit is contained in:
parent
ac4e13efe8
commit
8eb545a37c
@ -3,10 +3,10 @@
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
DECLARE @BatchSize INT = 100
|
||||
|
||||
BEGIN TRANSACTION User_DeleteById
|
||||
|
||||
DECLARE @BatchSize INT = 100
|
||||
WHILE @BatchSize > 0
|
||||
BEGIN
|
||||
DELETE TOP(@BatchSize)
|
||||
@ -14,10 +14,18 @@ BEGIN
|
||||
[dbo].[Cipher]
|
||||
WHERE
|
||||
[UserId] = @Id
|
||||
AND [Type] > 0
|
||||
|
||||
SET @BatchSize = @@ROWCOUNT
|
||||
END
|
||||
|
||||
DELETE
|
||||
FROM
|
||||
[dbo].[Cipher]
|
||||
WHERE
|
||||
[UserId] = @Id
|
||||
AND [Type] = 0
|
||||
|
||||
DELETE
|
||||
FROM
|
||||
[dbo].[Device]
|
||||
|
Loading…
Reference in New Issue
Block a user