将postgres数据库导入到Rails项目的新本地设置

时间:2014-04-30 06:16:30

标签: ruby-on-rails database postgresql import rake

我正在尝试将旧数据库(postgre sql)导入到使用Ruby On Rails构建的本地环境中的同一应用程序的新设置。我在ROR非常业余我有一个数据库转储文件(扩展名.dmp)和schema.rb看起来不错。但每一个耙子都是命令导致相同的错误,我无法追踪问题。我真的需要一些解决方案....错误如下.....

`

Cynosures-Mac-mini:sunridgerv cynosure$ bundle exec rake db:schema:load
rake aborted!
PG::Error: ERROR:  relation "rv_classes" does not exist
LINE 4:              WHERE a.attrelid = '"rv_classes"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"rv_classes"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:1061:in `exec'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:1061:in `exec_no_cache'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:615:in `block in exec_query'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:245:in `block in log'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:240:in `log'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:614:in `exec_query'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:1186:in `column_definitions'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:804:in `columns'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `block (2 levels) in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:92:in `block in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `yield'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `default'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `block in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/base.rb:717:in `yield'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/base.rb:717:in `default'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/base.rb:717:in `columns_hash'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/locking/optimistic.rb:145:in `locking_enabled?'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/relation.rb:111:in `to_a'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/relation/finder_methods.rb:159:in `all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.1.10/lib/active_record/base.rb:441:in `all'
/Users/cynosure/Documents/myapp/sunridgerv/app/models/rv_class.rb:7:in `<class:RvClass>'
/Users/cynosure/Documents/myapp/sunridgerv/app/models/rv_class.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:456:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:456:in `block in load_file'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:640:in `new_constants_in'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:455:in `load_file'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:342:in `require_or_load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:489:in `load_missing_constant'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:181:in `block in const_missing'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:179:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:179:in `const_missing'
/Users/cynosure/Documents/myapp/sunridgerv/app/admin/rv_classes.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:640:in `new_constants_in'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/application.rb:164:in `block in load!'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/application.rb:164:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/application.rb:164:in `load!'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/application.rb:182:in `routes'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin.rb:74:in `routes'
/Users/cynosure/Documents/myapp/sunridgerv/config/routes.rb:32:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.1.10/lib/action_dispatch/routing/route_set.rb:264:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.1.10/lib/action_dispatch/routing/route_set.rb:264:in `eval_block'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.1.10/lib/action_dispatch/routing/route_set.rb:241:in `draw'
/Users/cynosure/Documents/myapp/sunridgerv/config/routes.rb:2:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:640:in `new_constants_in'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application/routes_reloader.rb:29:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application/routes_reloader.rb:29:in `load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application/routes_reloader.rb:13:in `reload!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application.rb:87:in `reload_routes!'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/reloader.rb:34:in `reload!'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/reloader.rb:97:in `reload!'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/reloader.rb:92:in `block in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/file_update_checker.rb:32:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/reloader.rb:83:in `execute_if_updated'
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-d7c784a2f1b1/lib/active_admin/reloader.rb:109:in `block in attach!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/callbacks.rb:404:in `_run_prepare_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.1.10/lib/action_dispatch/middleware/reloader.rb:46:in `prepare!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application.rb:96:in `initialize!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/cynosure/Documents/myapp/sunridgerv/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:240:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:240:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:640:in `new_constants_in'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:240:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application.rb:83:in `require_environment!'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.1.10/lib/rails/application.rb:203:in `block (2 levels) in initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:schema:load => environment

`

1 个答案:

答案 0 :(得分:0)

得到了解决我在我的routes.rb中评论了ActiveAdmin.routes(self)来运行它运行的rake命令。然后取消评论它。没有与数据库相关的错误