Add update script

This commit is contained in:
calzoneman 2013-05-31 00:48:11 -04:00
parent d7abefa23e
commit b0a9a29386
1 changed files with 21 additions and 0 deletions

21
update.js Normal file
View File

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