diff --git a/migrations/20150107_plan_dateUpdated_null.js b/migrations/20150107_plan_dateUpdated_null.js new file mode 100644 index 0000000000..ae231a0414 --- /dev/null +++ b/migrations/20150107_plan_dateUpdated_null.js @@ -0,0 +1,5 @@ +db.users.update( + {'purchased.plan.customerId':{$ne:null}, 'purchased.plan.dateUpdated':null}, + {$set: {'purchased.plan.datedUpdated': new Date('12/01/2014')}}, + {multi:true} +); \ No newline at end of file diff --git a/src/controllers/payments/index.js b/src/controllers/payments/index.js index fea3c73025..c2f83959de 100644 --- a/src/controllers/payments/index.js +++ b/src/controllers/payments/index.js @@ -39,6 +39,7 @@ exports.createSubscription = function(data, cb) { p.extraMonths += months; } else { p.dateTerminated = moment(p.dateTerminated).add({months: months}).toDate(); + if (!p.dateUpdated) p.dateUpdated = new Date(); } if (!p.customerId) p.customerId = 'Gift'; // don't override existing customer, but all sub need a customerId } else {