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, + ); + }, +);