i'm trying the db-migrate library to handle migration for my application but i can't seem to figure out how to connect to my local postgres database. Here're my configs: (I'm using postgres v13 on ubuntu 20.14)
// database.json
{
"dev": {
"driver": "pg",
"user": "postgres",
"password": "*****",
"host": "localhost",
"port": "5432",
"schema": "public"
}
}
I have a migration file
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};
exports.up = function (db) {
return db.createTable('users', {
columns: {
id: { type: 'int', primaryKey: true, autoIncrement: true },
name: { type: 'string', notNull: true, unique: true,}
},
ifNotExists: true
});
};
exports.down = function(db) {
return db.dropTable('users');
};
exports._meta = {
"version": 1
};
And then i try running npx db-migrate up
and getting this error
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: connect ETIMEDOUT 18.140.31.15:5432
at module.exports (/home/tom/Workspace/mark/node_modules/db-migrate/lib/commands/helper/assert.js:9:14)
I have no idea why it's trying to connect to 18.140.31.15
while my config file has stated the host to be localhost
.
Anyone has any idea what i'm doing wrong here ?