added db builder as a node file

This commit is contained in:
Martin Donnelly 2016-04-04 15:01:42 +01:00
parent 65ca406f6b
commit 31151ab75a

View File

@ -9,13 +9,6 @@ var db = require('./server/units/db-connector').dbConnection;
var dbAccount = require('./server/units/db-accounts')(db); var dbAccount = require('./server/units/db-accounts')(db);
var exec = require('child_process').exec; var exec = require('child_process').exec;
function prepare_db() {
exec('psql -Upostgres -d oBrand -h localhost -f ./obrand.sql', function(err) {
if (err !== null) {
console.log('exec error: ' + err);
}
});
}
function addUsers() { function addUsers() {
'use strict'; 'use strict';
@ -40,5 +33,16 @@ function addUsers() {
}); });
} }
function prepare_db() {
exec('psql -Upostgres -d oBrand -h localhost -f ./obrand.sql', function(err) {
if (err !== null) {
console.log('exec error: ' + err);
} else {
addUsers();
}
});
}
prepare_db(); prepare_db();
addUsers();