2012-12-08 61 views
0

运行heroku run rake db:migrate和得到的错误:的Heroku:耙分贝:迁移失败,MongoDB的

Running `rake db:migrate` attached to terminal... up, run.9259 
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /app/config/application.rb:10) 
WARNING: Global access to Rake DSL methods is deprecated. Please include 
    ... Rake::DSL into classes and modules which use the Rake DSL methods. 
WARNING: DSL method Quora::Application#task called at /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:214:in `initialize_tasks' 
rake aborted! 
Database should be a Mongo::DB, not NilClass. 

当地一切正常。我有一个mongoid.yml文件,其中包含配置蒙戈并创建了一个mongohq蒙戈DB:

defaults: &defaults 
    host: '127.0.0.1' 
    autocreate_indexes: false 
    allow_dynamic_fields: true 
    include_root_in_json: false 
    parameterize_keys: true 
    persist_in_safe_mode: false 
    raise_not_found_error: true 
    reconnect_time: 3 

development: 
    <<: *defaults 
    database: mydb_development 

development_mongohq: 
    <<: *defaults 
    #use demo mongohq database for fast run 
    uri: mongodb://user:[email protected]:10016/app9861715 

test: 
    <<: *defaults 
    database: quora_test 

# set these environment variables on your prod server 
production: 
    <<: *defaults 
    host: '127.0.0.1' 
    database: mydb 

我试图寻找一个解决方案或者对如何没有成功修复任何方向。我究竟做错了什么?

编辑:我加入include Rake::DSL我的Rake文件,现在初步警告走了,但我仍然得到:

heroku run rake db:migrate 
Running `rake db:migrate` attached to terminal... up, run.4751 
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /app/config/application.rb:11) 
rake aborted! 
Database should be a Mongo::DB, not NilClass. 

Tasks: TOP => db:migrate => environment 
(See full trace by running task with --trace) 

回答

0

我想你错过:

adapter: mongodb 

这里是我的设置为postgres database.yml:

development: 
    adapter: postgresql 
    encoding: unicode 
    database: db 
    pool: 50 
    username: user 
    password: pwd 
    host: localhost 

你可能想看看这篇文章,以及:

https://stackoverflow.com/a/6757749/169277

+0

哎@ant我相信mongoid是一个充满不更换适配器 – Tom

+0

请参阅编辑 – ant