Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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;
        }
    }
};
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.