开发者

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

I have a Sinatra DataMapper app hitting a sqlite3 database that I am attempting to deploy to Heroku. First pass, I included my datab开发者_如何学Goase 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜