[FIX] #11692 - Suppress error when drop collection in migration to suit to … (#13091)

* #11692 - Suppress error when drop collection in migration to suit to concurrent execution
pull/13097/head^2
Xuhao 6 years ago committed by Douglas Gubert
parent 3c8ae75202
commit a599a4aaf9
  1. 10
      server/startup/migrations/v099.js

@ -201,11 +201,15 @@ RocketChat.Migrations.add({
}).then(() => {
const avatarsFiles = new Mongo.Collection('avatars.files');
const avatarsChunks = new Mongo.Collection('avatars.chunks');
avatarsFiles.rawCollection().drop();
avatarsChunks.rawCollection().drop();
try {
avatarsFiles.rawCollection().drop();
avatarsChunks.rawCollection().drop();
} catch (error) {
console.warn('Migration Error: avatars.files and avatars.chunks collections may not exist!');
}
RocketChat.models.Settings.remove({ _id: 'Accounts_AvatarStoreType' });
RocketChat.models.Settings.remove({ _id: 'Accounts_AvatarStorePath' });
});
}).catch((error) => console.error(error));
}, 1000);
});
},

Loading…
Cancel
Save