diff options
author | Lauri Ojansivu <x@xet7.org> | 2020-05-25 17:54:51 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2020-05-25 17:54:51 +0300 |
commit | d52affe65893f17bab59bb43aa9f5afbb54993d3 (patch) | |
tree | 82b88066d4fb8efb6610ed77177d3747d34f0480 /server/migrations.js | |
parent | 23dcd084a49de4e6568527d8f97ed25adb04dafd (diff) | |
download | wekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.tar.gz wekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.tar.bz2 wekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.zip |
Move In Progress ostrio-files changes to separate branch, and revert ostrio-files changes, so that:
- Export to CSV/TSV with custom fields works
- Attachments are not exported to disk
- It is possible to build arm64/s390x versions again.
Thanks to xet7 !
Related #3110
Diffstat (limited to 'server/migrations.js')
-rw-r--r-- | server/migrations.js | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/server/migrations.js b/server/migrations.js index 72b39ea7..5655bd1d 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -80,7 +80,7 @@ Migrations.add('lowercase-board-permission', () => { Migrations.add('change-attachments-type-for-non-images', () => { const newTypeForNonImage = 'application/octet-stream'; Attachments.find().forEach(file => { - if (!file.isImage) { + if (!file.isImage()) { Attachments.update( file._id, { @@ -1044,46 +1044,3 @@ Migrations.add('add-sort-field-to-boards', () => { } }); }); - -import { MongoInternals } from 'meteor/mongo'; - -Migrations.add('change-attachment-library', () => { - const fs = require('fs'); - CFSAttachments.find().forEach(file => { - const bucket = new MongoInternals.NpmModule.GridFSBucket(MongoInternals.defaultRemoteCollectionDriver().mongo.db, {bucketName: 'cfs_gridfs.attachments'}); - const gfsId = new MongoInternals.NpmModule.ObjectID(file.copies.attachments.key); - const reader = bucket.openDownloadStream(gfsId); - let store = Attachments.storagePath(); - if (store.charAt(store.length - 1) === '/') { - store = store.substring(0, store.length - 1); - } - const path = `${store}/${file.name()}`; - const fd = fs.createWriteStream(path); - reader.pipe(fd); - reader.on('end', () => { - let opts = { - fileName: file.name(), - type: file.type(), - size: file.size(), - fileId: file._id, - meta: { - userId: file.userId, - boardId: file.boardId, - cardId: file.cardId - } - }; - if (file.listId) { - opts.meta.listId = file.listId; - } - if (file.swimlaneId) { - opts.meta.swimlaneId = file.swimlaneId; - } - Attachments.addFile(path, opts, (err, fileRef) => { - if (err) { - console.log('error when migrating', file.name(), err); - } - }); - }); - }); -}); - |