Problem pushing sqlite3 db to heroku: lib/taps/schema.rb:30:in `sqlite_config': undefined method `[]' for nil:NilClass (NoMethodError)

StackOverflow https://stackoverflow.com/questions/1634693

  •  06-07-2019
  •  | 
  •  

Question

I have a Sinatra DataMapper app hitting a sqlite3 database that I am attempting to deploy to Heroku. First pass, I included my database file in the git repo. This works, as in the app runs, but production data does not belong in the repository. It doesn't really work though because the database is read-only.

I then removed the db file for source control and attempted a heroku db:push sqlite://db/my-app.db. This command yields the following stact trace:

my-app/(master) ~ heroku db:push sqlite:://db/my-app.db 
Sending schema
/Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:30:in `sqlite_config': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:24:in `create_config'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:36:in `connection'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:43:in `dump'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:52:in `dump_without_indexes'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/schema:24
Sending data
0 tables, 0 records
Sending indexes
/Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:30:in `sqlite_config': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:24:in `create_config'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:36:in `connection'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:43:in `dump'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/../lib/taps/schema.rb:62:in `indexes'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.19/lib/taps/../../bin/schema:26
Resetting sequences

Any idea what may be causing this and how I can fix it?

Was it helpful?

Solution

Heroku needs a schema.rb to 'prep' the database instance (Postgres) that will receive your data via heroku db:push. I generated a schema.rb via rails. Deployed that to heroku and then the db push worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top