Sequalize尝试在Heroku上运行迁移时出错
因此,我已经三次检查了我的config.json,以确保所有键都与heroku数据库对齐:Sequalize尝试在Heroku上运行迁移时出错,heroku,database-migration,sequelize.js,Heroku,Database Migration,Sequelize.js,因此,我已经三次检查了我的config.json,以确保所有键都与heroku数据库对齐: "production": { "name": "NAME", "user": "USER", "port": "5432", "pass": "PASSWORD", "host": "HOST", "dialect": "postgres" } 我知道这些值正在工作,因为我可以使用pgcommander访问数据库。然后,我执行以下步骤: heroku配置:设置节点\u ENV=
"production": {
"name": "NAME",
"user": "USER",
"port": "5432",
"pass": "PASSWORD",
"host": "HOST",
"dialect": "postgres"
}
我知道这些值正在工作,因为我可以使用pgcommander访问数据库。然后,我执行以下步骤:
heroku配置:设置节点\u ENV='production'--app app\u NAME
heroku run node\u modules/.bin/sequelize db:migrate
但在迁移失败后,始终会出现以下错误:
[00:27:42] Finished 'db:migrate' after 88 ms
Unable to connect to database: Error: SequelizeConnectionError: no PostgreSQL user name specified in startup packet
谷歌搜索错误返回的相关结果数量惊人地少
感谢您的帮助。我刚刚通过更改我的
config.json
并使用不同顺序的heroku命令解决了这个问题:
首先我必须提升heroku db:然后改变我的
config.json
对下列事项:
"production": {
"use_env_variable": "DATABASE_URL"
}
然后在终端中运行以下命令:
heroku运行bash
现在在heroku bash中:
续集数据库:迁移
我仍然不知道为什么在config.json中指定db url的每个键会给我一个错误,因为它们应该完全相同