I'm using node-migrate
to create a migration file. Inside the up()
command, I want to use node-postgres
to create my tables.
I'm sorry this post is empty, but I cannot find out how you do this anywhere. My db.js
is as follows:
module.exports = {
getDatabaseClient: function () {
var pgUsername = "USERNAME";
var pgPassword = "PASSWORD";
var pgAddress = "localhost:5432";
var pgDatabase = "DATABSE";
// postgres connection strings follow the specific format below:
var connectionString = util.format("pg://%s:%s@%s/%s",
pgUsername, pgPassword, pgAddress, pgDatabase)
var client = new pg.Client(connectionString);
if (client) {
client.connect();
return client;
} else {
return null;
}
}
};