[NEW]Added file type filter to RoomFiles (#15289)
parent
7d29c68fe4
commit
28e290cc46
@ -0,0 +1,28 @@ |
||||
import { Migrations } from '../../../app/migrations'; |
||||
import { Uploads } from '../../../app/models'; |
||||
|
||||
Migrations.add({ |
||||
version: 163, |
||||
up() { |
||||
/* |
||||
* Migrate existing `rocketchat_uploads` documents to include the typeGroup |
||||
*/ |
||||
|
||||
Uploads.find({ |
||||
type: { |
||||
$exists: true, |
||||
}, |
||||
typeGroup: { |
||||
$exists: false, |
||||
}, |
||||
}).forEach((upload) => { |
||||
Uploads.model.direct.update({ |
||||
_id: upload._id, |
||||
}, { |
||||
$set: { |
||||
typeGroup: upload.type.split('/').shift(), |
||||
}, |
||||
}); |
||||
}); |
||||
}, |
||||
}); |
Loading…
Reference in new issue