gpt4 book ai didi

mysql - 将nodejs应用程序部署到heroku后出现SequelizeDatabaseError

转载 作者:行者123 更新时间:2023-11-29 15:38:36 27 4
gpt4 key购买 nike

我有一个用 Nodejs 编写的电子商务应用程序。我最近将我的应用程序部署到heroku..以下是配置:

Development mode:

database: mysql

Production Mode

database: postgresql add-on

部署成功完成,我运行了heroku run bash命令,然后运行了sequelize -m命令。之后我完成了db:migrate并且所有迁移都成功完成。但是当我尝试搜索路线时,我我在许多路线上都遇到错误。但每条路线都有相似之处。

例如:这是我在创建用户路由时得到的响应。

  "name": "SequelizeDatabaseError",
"parent": {
"name": "error",
"length": 105,
"severity": "ERROR",
"code": "42703",
"position": "47",
"file": "parse_relation.c",
"line": "3294",
"routine": "errorMissingColumn",
"sql": "SELECT \"id\", \"username\", \"email\", \"password\", \"image\", \"createdAt\", \"updatedAt\" FROM \"Users\" AS \"User\" WHERE \"User\".\"email\" = 'developerstackbase@gmail.com' LIMIT 1;"
},
"original": {
"name": "error",
"length": 105,
"severity": "ERROR",
"code": "42703",
"position": "47",
"file": "parse_relation.c",
"line": "3294",
"routine": "errorMissingColumn",
"sql": "SELECT \"id\", \"username\", \"email\", \"password\", \"image\", \"createdAt\", \"updatedAt\" FROM \"Users\" AS \"User\" WHERE \"User\".\"email\" = 'developerstackbase@gmail.com' LIMIT 1;"
},
"sql": "SELECT \"id\", \"username\", \"email\", \"password\", \"image\", \"createdAt\", \"updatedAt\" FROM \"Users\" AS \"User\" WHERE \"User\".\"email\" = 'developerstackbase@gmail.com' LIMIT 1;"
}

最佳答案

您能否在这两个环境中使用相同的数据库,并更新它(如果它在您的本地运行)。

关于mysql - 将nodejs应用程序部署到heroku后出现SequelizeDatabaseError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57936258/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com