I've an external database ready and want to now use that database with my heroku app. But I'm unable to edit the Configuration Variables. I tried using GUI, Which says, Cannot overwrite attachment values DATABASE_URL. While I tried using CLI as well. I used the command: heroku config:addDATABASE_URL="postgresql://username:password@IP:PORT". However, this throws an error ........ is not a heroku command.
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
- Django distinct is not working
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Right way to deploy Rails + Puma + Postgres app to
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- AWS S3 in rails - how to set the s3_signature_vers
- how to call a active record named scope with a str
I got the very same situation today when I need to change
postgres
topostgis
. Detach doesn't work for me so I done this todatabase.yml
:https://github.com/rgeo/activerecord-postgis-adapter/issues/214.
Solved it. Just for the reference of the users who have the same issue or want to have a similar implementation. Here's the workaround which worked for me.
Heroku no more overwrites databse.yml, so I just modified the DATBASE_URL in the database.yml and pushed it :)
It worked too!
Source : https://discussion.heroku.com/t/rails-4-1-database-yml-no-longer-overwritten-on-heroku/550
An alternative method which does not require detaching (which may not be a desired outcome of the switch) is to simply attach the new database and then promote it, which the Heroku Documents explicitly states as a way to set the
DATABASE_URL
.As explained in this article, the correct syntax to set/add a configuration variable is
However, it looks like (see the comments) the
DATABASE_URL
has been deprecated and trying to update it will trigger an error.Based on the Heroku docs this is how you would share a database with multiple apps.
After trying out most these answers, I came across an update in 2016, here: the database needs to be detached first, then update the variable of the DATABASE_URL.