Skip to content
Snippets Groups Projects
Commit e9ba87d8 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Uploads: Migration

parent e2666af5
No related branches found
No related tags found
No related merge requests found
RocketChat.Migrations.add({
version: 96,
up() {
const query = {
$or: [{
's3.path': {
$exists: true
}
}, {
'googleCloudStorage.path': {
$exists: true
}
}]
};
RocketChat.models.Uploads.find(query).forEach((record) => {
if (record.s3) {
RocketChat.models.Uploads.model.direct.update({_id: record._id}, {
$set: {
'store': 'AmazonS3:Uploads',
AmazonS3: {
path: record.s3.path + record._id
}
},
$unset: {
s3: 1
}
}, {multi: true});
} else {
RocketChat.models.Uploads.model.direct.update({_id: record._id}, {
$set: {
store: 'GoogleCloudStorage:Uploads',
GoogleStorage: {
path: record.googleCloudStorage.path + record._id
}
},
$unset: {
googleCloudStorage: 1
}
}, {multi: true});
}
});
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment