fix(migrations): return to generic state

This commit is contained in:
Sabe Jones
2017-06-04 02:58:42 +00:00
parent 2e9bc2c31c
commit db0b0d6b6d
2 changed files with 8 additions and 5 deletions

View File

@@ -17,5 +17,8 @@ function setUpServer () {
setUpServer(); setUpServer();
// Replace this with your migration // Replace this with your migration
var processUsers = require('./takeThis'); var processUsers = require('./groups/update-groups-with-group-plans');
processUsers(); processUsers()
.catch(function (err) {
console.log(err)
})

View File

@@ -1,4 +1,4 @@
var migrationName = '20170601_takeThis.js'; // Update per month var migrationName = '20170502_takeThis.js'; // Update per month
var authorName = 'Sabe'; // in case script author needs to know when their ... var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
@@ -7,14 +7,14 @@ var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
*/ */
var monk = require('monk'); var monk = require('monk');
var connectionString = 'mongodb://sabrecat:hzpGJTRBn28KBZp@ds013393-a1.mlab.com:13393/habitica?auto_reconnect=true'; var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false }); var dbUsers = monk(connectionString).get('users', { castIds: false });
function processUsers(lastId) { function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users): // specify a query to limit the affected users (empty for all users):
var query = { var query = {
'migration':{$ne:migrationName}, 'migration':{$ne:migrationName},
'challenges':{$in:['87923188-f298-41ba-95ea-cbfa712ed95b']} // Update per month 'challenges':{$in:['69999331-d4ea-45a0-8c3f-f725d22b56c8']} // Update per month
}; };
if (lastId) { if (lastId) {