fix(kickstarter): better migration logic
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
const MIGRATION_NAME = '20190927_kickstarter';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { model as User } from '../../website/server/models/user';
|
||||
import { model as User } from '../../../website/server/models/user';
|
||||
|
||||
const progressCount = 1000;
|
||||
let count = 0;
|
||||
@@ -11,11 +11,22 @@ async function updateUser (user) {
|
||||
count++;
|
||||
|
||||
const set = {};
|
||||
let push = {pinnedItems: {$each: []}};
|
||||
|
||||
set.migration = MIGRATION_NAME;
|
||||
|
||||
set['items.gear.owned.armor_special_ks2019'] = false;
|
||||
const push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_ks2019', _id: uuid()}};
|
||||
// set['items.gear.owned.armor_special_ks2019'] = false;
|
||||
// push.pinnedItems.$each.push({type: 'marketGear', path: 'gear.flat.armor_special_ks2019', _id: uuid()});
|
||||
set['items.gear.owned.head_special_ks2019'] = false;
|
||||
push.pinnedItems.$each.push({type: 'marketGear', path: 'gear.flat.head_special_ks2019', _id: uuid()});
|
||||
// set['items.gear.owned.shield_special_ks2019'] = false;
|
||||
// push.pinnedItems.$each.push({type: 'marketGear', path: 'gear.flat.shield_special_ks2019', _id: uuid()});
|
||||
// set['items.gear.owned.weapon_special_ks2019'] = false;
|
||||
// push.pinnedItems.$each.push({type: 'marketGear', path: 'gear.flat.weapon_special_ks2019', _id: uuid()});
|
||||
set['items.gear.owned.eyewear_special_ks2019'] = false;
|
||||
push.pinnedItems.$each.push({type: 'marketGear', path: 'gear.flat.eyewear_special_ks2019', _id: uuid()});
|
||||
// set['items.pets.Gryphon-Gryphatrice'] = 5;
|
||||
// set['items.mounts.Gryphon-Gryphatrice'] = true;
|
||||
|
||||
return await User.update({_id: user._id}, {$set: set, $push: push}).exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user