Ruby-on-rails – Heroku App is Reading database.yml File

herokurubyruby-on-rails

From what I can gather, Heroku is supposed to generate a database.yml file automatically, and ignore the local one. However, I am seeing an error where that is not true, and my changes to the local database.yml are affecting the Heroku app. This is problematic because I have no idea how I should setup production portion of the file so Heroku can find the right database.

For instance with the following

production: 
    adapter: sqlite3 
    database: db/production.sqlite3 
    pool: 5 
    timeout: 5000

followed by the db:migration

$:~/Apps/DancingCupid/DancingCupid$ heroku rake --trace db:migrate

spits out

rake aborted!
unable to open database file
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.5/lib/active_record/connection_adapters/sqlite3_adapter.rb:27:in `initialize' 
...

I can get different errors depending on what type of database I sent for production.

Besides deleting the app and making a new one, is there a way to fix this problem?

Best Answer

Heroku definitely rewrite your database.yml on push so it doesn't matter what is in there in source control.

To confirm this do heroku run bash which will connect you to a bash session in your app then look do a cat config\database.yml and you will see how they have rewritten it.

Related Topic