mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
fix
This commit is contained in:
parent
ef6d835391
commit
1e66cc9193
2 changed files with 12 additions and 2 deletions
|
|
@ -4,11 +4,12 @@ const MIGRATION_NAME = '20190716_groups_fix';
|
|||
import monk from 'monk';
|
||||
import nconf from 'nconf';
|
||||
const CONNECTION_STRING = nconf.get('MIGRATION_CONNECT_STRING');
|
||||
let backupUsers = monk(CONNECTION_STRING).get('users', { castIds: false });
|
||||
|
||||
import { model as User } from '../../../website/server/models/user';
|
||||
|
||||
const progressCount = 1000;
|
||||
let count = 0;
|
||||
let backupUsers;
|
||||
|
||||
async function updateUser (user) {
|
||||
count++;
|
||||
|
|
@ -44,6 +45,15 @@ module.exports = async function processUsers () {
|
|||
'auth.timestamps.loggedin': {$gt: new Date('2019-07-15')},
|
||||
};
|
||||
|
||||
let backupDb = monk(CONNECTION_STRING);
|
||||
const backupDbPromise = new Promise((resolve, reject) => {
|
||||
backupDb.then(() => resolve()).catch((e) => reject(e));
|
||||
});
|
||||
|
||||
await backupDbPromise;
|
||||
console.log('Connected to backup db');
|
||||
backupUsers = backupDb.get('users', { castIds: false });
|
||||
|
||||
const fields = {
|
||||
_id: 1,
|
||||
party: 1,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function setUpServer () {
|
|||
setUpServer();
|
||||
|
||||
// Replace this with your migration
|
||||
const processUsers = require('');
|
||||
const processUsers = require('./archive/2019/20190716_groups_fix.js');
|
||||
processUsers()
|
||||
.then(function success () {
|
||||
process.exit(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue