mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
* upgrade gulp-babel * upgrade babel-eslint * upgrade eslint-friendly-formatter * start upgrading chai * start to upgrade eslint * restore skipped tests * start to upgrqde monk * fix linting and remove unused file * fix mocha notifications, and common tests * fix unit tests * start to fix initrgration tests * more integration tests fixes * upgrade monk to latest version * lint /scripts * migrations: start moving to /archive unused migrations and run eslint with --fix * lint migrations * fix more integration tests * fix test
12 lines
651 B
JavaScript
12 lines
651 B
JavaScript
// node .migrations/20131022_restore_ads.js
|
|
let mongo = require('mongoskin');
|
|
let _ = require('lodash');
|
|
let dbBackup = mongo.db('localhost:27017/habitrpg?auto_reconnect');
|
|
let dbLive = mongo.db('localhost:27017/habitrpg2?auto_reconnect');
|
|
let count = 89474;
|
|
dbBackup.collection('users').findEach({$or: [{'flags.ads': 'show'}, {'flags.ads': null}]}, {batchSize: 10}, function (err, item) {
|
|
if (err) return console.error({err});
|
|
if (!item || !item._id) return console.error('blank user');
|
|
dbLive.collection('users').update({_id: item._id}, {$set: {'purchased.ads': false}, $unset: {'flags.ads': 1}});
|
|
if (--count <= 0) console.log('DONE!');
|
|
}); |