Answer the question
In order to leave comments, you need to log in
Why does db-migrate throw a self signed certificate error?
I decided to add migrations to my project, I'm trying to use db-migrate configured database.json here is the config:
{
"prod": {
"driver": "pg",
"user": {"ENV": "USER"},
"password": {"ENV": "PGPASSWORD"},
"host": {"ENV": "PGHOST"},
"database": {"ENV": "PGDATABASE"},
"port": {"ENV": "PGPORT"},
"ssl": "true",
"schema": "public"
},
"dev": {
"driver": "pg",
"user": {"ENV": "USER"},
"password": {"ENV": "PGPASSWORD"},
"host": {"ENV": "PGHOST"},
"database": {"ENV": "PGDATABASE"},
"port": {"ENV": "PGPORT"},
"ssl": "true",
"schema": "public"
}
}
'use strict';
var dbm;
var type;
var seed;
/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};
exports.up = function(db) {
db.createTable('users', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
email: 'string',
password: 'string',
confirmed: 'int',
hash: 'string',
salt: 'string',
name: 'string',
surname: 'string',
link: 'string',
hostname: 'string',
avatar: 'string'
}, callback);
};
exports.down = function(db) {
db.dropTable('users', callback);
};
exports._meta = {
"version": 1
};
Answer the question
In order to leave comments, you need to log in
I installed knex, here is my config with which the connection worked (knexfile.js):
require('dotenv').config()
module.exports = {
development: {
client: 'postgresql',
connection: {
database: process.env.PGDATABASE,
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
ssl: { rejectUnauthorized: false }
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
staging: {
client: 'postgresql',
connection: {
database: process.env.PGDATABASE,
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
ssl: { rejectUnauthorized: false }
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
production: {
client: 'postgresql',
connection: {
database: process.env.PGDATABASE,
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
ssl: { rejectUnauthorized: false }
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question