【发布时间】:2018-10-19 07:28:03
【问题描述】:
我正在尝试将 mysql 数据库迁移到 heroku cleardb。我在做节点服务。
我尝试过的代码是,
knexfile.js
production: {
client: "mysql",
connection: {
host: "us-cdbr-iron-east-04.cleardb.net",
user: "bcf521a*******",
password: "9282****",
database: "heroku_9c9d767dbb*****"
}
}
在 heroku 中,使用 CLEARDB_DATABASE_URL 设置配置。完成。当我尝试运行时
heroku run node_modules/.bin/knex migrate:latest
Running node_modules/.bin/knex migrate:latest on ⬢ hidden-taiga-65640
... up, run.7007 (Free)
Using environment: production
终端错误显示,
knex: Required configuration option 'client' is missing
如何解决这个问题?
【问题讨论】:
-
你在 heroku 环境中设置了 NODE_ENV=production 吗?另外,您没有显示整个 knex 文件,因此也可能存在一些问题。
-
@MikaelLepistö,当我运行迁移时,它将环境作为生产环境。
-
我尝试手动导入,这给出了 current_timestamp 错误。因为版本
标签: mysql node.js heroku knex.js cleardb