Troubleshooting db:push errors on Heroku
Here is the error I was seeing today (truncated for brevity):
$ heroku db:push --app=my-app-name --confirm=my-app-name
Loaded Taps v0.3.23
Auto-detected local database: postgres://localhost/app_development?encoding=utf8
Sending schema
Schema: 100% |==========================================| Time: 00:00:29
Sending indexes
table_1: 100% |==========================================| Time: 00:00:01
schema_migrat: 100% |==========================================| Time: 00:00:00
table_2: 100% |==========================================| Time: 00:00:00
Sending data
20 tables, 2,783 records
table_3: 0% | | ETA: --:--:--
Saving session to push_201205300813.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: LoadError: no such file to load -- sequel/adapters/
["/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:in `require'", ...This was caused by my app not having a DATABASE_URL config variable set. I assumed that db:push would fail much earlier if it wasn't able to connect to a database, but this turned out to not be accurate.
The simple solution was to promote the existing database:
$ heroku pg:promote HEROKU_POSTGRESQL_COPPER --app=my-app-nameTo find the name of the database to use in the previous command, use heroku config --app=my-app-name. It should have a name like HEROKU_POSTGRESQL_*_URL.