diff --git a/migrations/freeMonth.js b/migrations/freeMonth.js new file mode 100644 index 0000000000..36f320746c --- /dev/null +++ b/migrations/freeMonth.js @@ -0,0 +1,11 @@ +// mongo habitrpg ./node_modules/moment/moment.js ./migrations/freeMonth.js + +db.users.update( + {_id:''}, + {$set:{ + 'purchased.plan.customerId':'temporary', + 'purchased.plan.paymentMethod':'Stripe', + 'purchased.plan.planId':'basic_earned', + 'purchased.plan.dateTerminated': moment().add('month',1).toDate() + }} +) \ No newline at end of file diff --git a/migrations/mysteryitems.js b/migrations/mysteryitems.js index 54ac120600..4f7e4dd837 100644 --- a/migrations/mysteryitems.js +++ b/migrations/mysteryitems.js @@ -1,5 +1,17 @@ -db.users.update( - {'purchased.plan.customerId':{$ne:null}}, - {$push: {'purchased.plan.mysteryItems':{$each:['back_mystery_201404','headAccessory_mystery_201404']}}}, - {multi:true} -) \ No newline at end of file +var _id = ''; +var update = { + $push: { + 'purchased.plan.mysteryItems':{ + $each:['back_mystery_201404','headAccessory_mystery_201404'] + } + } +}; + +if (_id) { + // singular (missing items) + db.users.update({_id:_id}, update); +} else { + // multiple (once @ start of event) + db.users.update({'purchased.plan.customerId':{$ne:null}}, update, {multi:true}); +} +