From 31151ab75a34d6870fec156c1a849d1db66c7a30 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 4 Apr 2016 15:01:42 +0100 Subject: [PATCH] added db builder as a node file --- dbconfig.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dbconfig.js b/dbconfig.js index b1871e2..7ab92a7 100644 --- a/dbconfig.js +++ b/dbconfig.js @@ -9,13 +9,6 @@ var db = require('./server/units/db-connector').dbConnection; var dbAccount = require('./server/units/db-accounts')(db); 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() { '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(); -addUsers();