1
0
mirror of https://github.com/bitwarden/server synced 2026-01-03 09:03:44 +00:00

update migration scripts for json favs/folders

This commit is contained in:
Kyle Spearrin
2017-04-17 11:55:16 -04:00
parent a684e03819
commit 94043d5006
2 changed files with 15 additions and 24 deletions

View File

@@ -5,18 +5,16 @@ select Id, UserId, JSON_VALUE(Data,'$.Name') AS [Name], CreationDate, RevisionDa
from cipher
where [type] = 0
insert into foldercipher
select FolderId, Id, UserId
from cipher
where [FolderId] is not null
update cipher set
Folders = concat('{"', userid, '":"', folderid, '"}')
where [userid] is not null
and [folderid] is not null
insert into favorite
select UserId, [Id]
from cipher
where Favorite = 1
update cipher set
Favorites = concat('{"', userid, '":true}')
where [Favorite] = 1
-- Step 2, drop each column
-- Step 2, verify data migration from step 1 then drop each column
alter table cipher drop constraint [FK_Cipher_Folder]
go