Reputation: 10683
Just looking at my database.yml file for my Rails 4 app and noticed there isn't any setting for the production database - only the test and development ones.
I don't actually have any issues but wanted to avoid other potential issues by posting this question.
Locally I use a PG database and I host my app on Heroku using a PG db too.
Should I have some settings in the yml for the production database file as I'm really not sure?
Upvotes: 5
Views: 4653
Reputation: 397
The above answers are no longer valid for Rails 4.x on Heroku. Heroku no longer overwrites your database.yml. You need the following entry in your config/database.yml file:
production:
url: <%= ENV['DATABASE_URL'] %>
Upvotes: 10
Reputation: 4545
If you host your application on Heroku and use a Heroku Postgres DB you don't need a production entry in your database.yml.
Heroku will replace your database.yml entirely with one that uses the DATABASE_URL from heroku:config.
So no, you don't need a production entry in your database.yml for Heroku-hosted apps.
Upvotes: 4
Reputation: 52356
Whatever you place in database.yml will be overwritten by Heroku during production deployment, as it uses its own application configuration to effectively write a new one.
https://devcenter.heroku.com/articles/ruby-support#build-behavior
Unless you need to deploy the database.yml to other environments, you can include it in gitignore
Upvotes: 13