mirror of https://github.com/calzoneman/sync.git
Add update script
This commit is contained in:
parent
d7abefa23e
commit
b0a9a29386
|
@ -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);
|
Loading…
Reference in New Issue