falsepositives migration (2nd round)

This commit is contained in:
Vicente J. Ruiz Jurado 2018-03-26 15:05:10 +02:00
parent 7886c1227e
commit b6accbadef

View file

@ -209,6 +209,20 @@ Meteor.startup(() => {
}
});
Migrations.add({
version: 16,
up: function moveToFalsePositivesUppercaseWithUser() {
const falsepositiveslower = new Mongo.Collection('falsepositives', { idGeneration: 'MONGO' });
falsepositiveslower.find({}).forEach((falseDoc) => {
const user = Meteor.users.findOne({ telegramChatId: falseDoc.chatId });
if (user) {
falseDoc.owner= user._id;
}
FalsePositives.insert(falseDoc);
});
}
});
// Set createdAt in users & subs
Migrations.migrateTo('latest');