Heroku 和 ClearDB 错误

Heroku and ClearDB error

我在 Rails 应用程序上有一个 Ruby,带有 mysql 数据库(使用 gem mysql2)。由于 Heroku 运行s postgres 我遵循了这个步骤以使其工作:

$>heroku addons:create cleardb:ignite
$>heroku config | grep CLEARDB_DATABASE_URL
$>heroku config:set DATABASE_URL='mysql2://my-url'

如所述here

问题是我在最后一条命令中收到此错误:

Setting config vars and restarting xxxxxx-xxxxx-16407... !!!
 ▸    Cannot overwrite attachment values DATABASE_URL.

我的应用程序不能 运行:

2016-03-18T10:31:31.413121+00:00 heroku[run.1567]: State changed from up to complete
2016-03-18T10:31:34.818303+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxx-xxxxx-16407.herokuapp.com request_id=236455b8-7a02-49f0-8e2e-a67341a81580 fwd="151.225.234.109" dyno= connect= service= status=503 bytes=
2016-03-18T10:31:35.308136+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxx-xxxx-16407.herokuapp.com request_id=974dab02-e914-42fb-ad96-5476e30e9d17 fwd="151.225.234.109" dyno= connect= service= status=503 bytes=
2016-03-18T10:31:35.434538+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxx-xxxxx-16407.herokuapp.com request_id=22bfdfd8-9cdf-4e3d-bb13-c616591bd91f fwd="151.225.234.109" dyno= connect= service= status=503 bytes=

我已经在 heroku 机器上执行了 bundle install 和 rake db:migrate。

你知道我该如何解决这个问题吗?

感谢 heroku 的支持,我解决了这个问题!

基本上我需要在 运行 新的数据库实现之前删除旧的数据库实现。这是我所做的:

$ heroku addons:destroy heroku-postgresql -a NAMEOFTHEAPP

然后再次执行安装 ClearDB 的过程。现在一切正常!

在添加新 DATABASE_URL 之前,您需要通过以下命令删除旧数据库:

$ heroku addons:destroy heroku-postgresql

我会问应用程序的名称。或者你可以直接使用

$ heroku addons:destroy heroku-postgresql -a NAMEOFTHEAPP