将sqlite3 db推送到heroku的问题:lib / taps / schema.rb:30:在`sqlite_config'中:未定义的方法`[]'用于nil:NilClass(NoMethodError)

时间:2009-10-28 01:27:21

标签: sqlite sinatra heroku

我有一个Sinatra DataMapper应用程序命中我试图部署到Heroku的sqlite3数据库。第一遍,我在git repo中包含了我的数据库文件。这与app运行时一样,但生产数据不属于存储库。它实际上并不起作用,因为数据库是只读的。

然后我删除了用于源代码管理的db文件并尝试了heroku db:push sqlite://db/my-app.db。此命令产生以下完整跟踪:

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

知道可能导致这种情况的原因以及我如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

Heroku需要schema.rb来“准备”将通过heroku db:push接收数据的数据库实例(Postgres)。我通过rails生成了schema.rb。将其部署到heroku,然后db push工作。