From c0918b5e280ee25036cd57d02e0f3dff9344d40d Mon Sep 17 00:00:00 2001 From: David Arnold Date: Mon, 14 Sep 2020 01:21:50 -0500 Subject: [PATCH] Mig: add migration cfs:* -> ostrio:files --- server/migrations.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/server/migrations.js b/server/migrations.js index 85d10c8e1..e3eac8eed 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -1044,3 +1044,38 @@ Migrations.add('add-default-profile-view', () => { } }); }); +Migrations.add( + 'adapt-attachments-to-ostrio-files-api-using-meta-and-drp-cfs-leacy', + () => { + const newTypeForNonImage = 'application/octet-stream'; + Attachments.find().forEach(file => { + Attachments.update( + file._id, + { + $set: { + 'meta.boardId': file.boardId, + 'meta.cardId': file.cardId, + 'meta.listId': file.listId, + 'meta.swimlaneId': file.swimlaneId, + }, + }, + noValidate, + ); + }); + Attachments.update( + {}, + { + $unset: { + original: '', // cfs:* legacy + copies: '', // cfs:* legacy + failures: '', // cfs:* legacy + boardId: '', + cardId: '', + listId: '', + swimlaneId: '', + }, + }, + noValidateMulti, + ); + }, +);