56 lines
977 B
JavaScript
56 lines
977 B
JavaScript
/**
|
|
*
|
|
* User: Martin Donnelly
|
|
* Date: 2016-04-04
|
|
* Time: 14:46
|
|
*
|
|
*/
|
|
var exec = require('child_process').exec;
|
|
|
|
|
|
|
|
function run_script() {
|
|
'use strict';
|
|
exec('psql postgres://amlrxqev:K11cvCplk0--oNafsYj4ISN-rVQmVS3y@jumbo.db.elephantsql.com:5432/amlrxqev -f ../sql/mdot.sql', function(err) {
|
|
if (err !== null) {
|
|
console.log('exec error: ', err);
|
|
return -1;
|
|
} else {
|
|
// addUsers();
|
|
console.log('All done...');
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function prepare_db() {
|
|
exec('psql -Upostgres -d oBrand -h localhost -f ./obrand.sql', function(err) {
|
|
if (err !== null) {
|
|
console.log('exec error: ' + err);
|
|
return -1;
|
|
} else {
|
|
addUsers();
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function createDB() {
|
|
'use strict';
|
|
exec('createdb -Upostgres -h localhost heat', function(err) {
|
|
if (err !== null) {
|
|
console.log('exec error: ' + err);
|
|
return -1;
|
|
} else {
|
|
prepare_db();
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
createDB();
|
|
//run_script();
|