Решил добавить миграции в свой проект, пытаюсь использовать db-migrate настроил database.json вот конфиг:
{
"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"
}
}
База данных находится на сервере heroku. К базе подключается без ошибок через DBeaver.
Создал миграцию:
'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
};
Выполняю db-migrate up, выводит:
C:\Users\kvono\Desktop\project> db-migrate up
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: self signed certificate
at module.exports (C:\Program Files\nodejs\node_modules\db-migrate\lib\commands\helper\assert.js:9:14)
at C:\Program Files\nodejs\node_modules\db-migrate\lib\commands\up.js:19:14
at C:\Program Files\nodejs\node_modules\db-migrate\connect.js:17:7
at C:\Program Files\nodejs\node_modules\db-migrate\lib\driver\index.js:95:9
at Client._connectionCallback (C:\Users\kvono\Desktop\project\node_modules\db-migrate-pg\index.js:710:7)
at Client._handleErrorWhileConnecting (C:\Users\kvono\Desktop\project\node_modules\pg\lib\client.js:305:19)
at Client._handleErrorEvent (C:\Users\kvono\Desktop\project\node_modules\pg\lib\client.js:315:19)
at Connection.emit (node:events:376:20)
at TLSSocket.reportStreamError (C:\Users\kvono\Desktop\project\node_modules\pg\lib\connection.js:53:12)
at TLSSocket.onConnectSecure (node:_tls_wrap:1498:34)
at TLSSocket.emit (node:events:376:20)
at TLSSocket._finishInit (node:_tls_wrap:933:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:707:12)
Подскажите почему db-migrate выдает ошибку self signed certificate? Как исправить?