From b0a9a293867bd41c09452ef3ca672595a8697670 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Fri, 31 May 2013 00:48:11 -0400 Subject: [PATCH] Add update script --- update.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 update.js diff --git a/update.js b/update.js new file mode 100644 index 00000000..b1a8435b --- /dev/null +++ b/update.js @@ -0,0 +1,21 @@ +var Config = require("./config.js"); +var Database = require("./database.js"); + +Config.DEBUG = true; +Database.setup(Config); +Database.init(); +var query; +var db = Database.getConnection(); + +// Check for already existing +query = "SELECT email FROM registrations WHERE 1"; +if(!db.querySync(query)) { + query = "ALTER TABLE registrations ADD email VARCHAR(255) NOT NULL"; + var res = db.querySync(query); + if(!res) { + console.log(db); + console.log("Update failed!"); + } +} +db.closeSync(); +process.exit(0);