From c1e3d95a84326dc45eb1a1daea52c4376b3d1658 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 23 Feb 2014 16:19:30 -0500 Subject: [PATCH] upgrade fix for new installs --- src/upgrade.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 26a3900644..45d146a116 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -23,6 +23,13 @@ Upgrade.check = function(callback) { var latestSchema = new Date(2014, 1, 22).getTime(); db.get('schemaDate', function(err, value) { + if(!value) { + db.set('schemaDate', latestSchema, function(err) { + callback(true); + }); + return; + } + if (parseInt(value, 10) >= latestSchema) { callback(true); } else { @@ -40,7 +47,7 @@ Upgrade.upgrade = function(callback) { function(next) { // Prepare for upgrade & check to make sure the upgrade is possible db.get('schemaDate', function(err, value) { - schemaDate = value; + schemaDate = parseInt(value, 10); if (schemaDate >= minSchemaDate || schemaDate === null) { next();