1
0
Fork 1
mirror of https://example.com synced 2024-11-24 01:26:39 +09:00
firefish/tools/migration/node.1522066477.user-account-keypair.js
2018-03-27 00:26:25 +09:00

16 lines
358 B
JavaScript

const { default: User } = require('../../built/api/models/user');
const { generate } = require('../../built/crypto_key');
const updates = [];
User.find({}).each(function(user) {
updates.push(User.update({ _id: user._id }, {
$set: {
account: {
keypair: generate(),
}
}
}));
}).then(function () {
Promise.all(updates)
}).then(process.exit);