feat(subscriptions): add free month script for users who canceled in old system

This commit is contained in:
Tyler Renelle 2014-05-06 10:13:33 -06:00
parent b0eb12bb5f
commit 4990a6d0e1
2 changed files with 28 additions and 5 deletions

11
migrations/freeMonth.js Normal file
View file

@ -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()
}}
)

View file

@ -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}
)
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});
}