Node.js 我应该在我的生产Knex构建中指定要在heroku上部署的主机?
我有一个knexfile,看起来像这样:Node.js 我应该在我的生产Knex构建中指定要在heroku上部署的主机?,node.js,postgresql,heroku,knex.js,Node.js,Postgresql,Heroku,Knex.js,我有一个knexfile,看起来像这样: module.exports = { testing: { client: 'postgresql', connection: { database: 'poker_handsdb' }, pool: { min:2, max: 10 }, migrations: { tableName: 'knex_migrations' } },
module.exports = {
testing: {
client: 'postgresql',
connection: {
database: 'poker_handsdb'
},
pool: {
min:2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
development: {
client: 'postgresql',
connection: {
database: 'poker_handsdb',
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
production: {
client: 'postgresql',
connection: {
database: 'poker_handsdb',
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
}
};
我将该应用程序部署到heroku,当我尝试运行knex migrate:latest时,出现以下错误:
连接ECONREFUSSED 127.0.0.1:5432
要在heroku上运行生产构建,我需要指定什么作为主机/db?我试图在heroku上运行本地托管的postgres实例有意义吗?您需要从heroku dashboard获取数据库的url,并在生产连接中使用它。它应该是一个以
postgres://
Ahh开头的url,这很有意义。我从未在heroku上创建过数据库。如果我运行heroku pg,我会得到“没有数据库”。如何在heroku上创建新的postrgres db?