The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/server/startup/migrations/v008.js

35 lines
1.2 KiB

RocketChat.Migrations.add({
version: 8,
up() {
console.log('Load old settings record');
const settings = RocketChat.models.Settings.findOne({
_id: 'settings'
});
if (settings) {
if (settings.CDN_PREFIX) {
RocketChat.models.Settings.insert({_id: 'CDN_PREFIX', value: settings.CDN_PREFIX, type: 'string', group: 'General'});
}
if (settings.ENV && settings.ENV.MAIL_URL) {
RocketChat.models.Settings.insert({_id: 'MAIL_URL', value: settings.ENV.MAIL_URL, type: 'string', group: 'SMTP'});
}
if (settings.denyUnverifiedEmails) {
RocketChat.models.Settings.insert({_id: 'Accounts_denyUnverifiedEmails', value: settings.denyUnverifiedEmails, type: 'boolean', group: 'Accounts'});
}
if (settings.public && settings.public.avatarStore && settings.public.avatarStore.type) {
RocketChat.models.Settings.insert({_id: 'avatarStore_type', value: settings.public.avatarStore.type, type: 'string', group: 'API'});
}
if (settings.public && settings.public.avatarStore && settings.public.avatarStore.path) {
RocketChat.models.Settings.insert({_id: 'avatarStore_path', value: settings.public.avatarStore.path, type: 'string', group: 'API'});
}
return RocketChat.models.Settings.remove({
_id: 'settings'
});
}
}
});