PG::InsufficientPrivilege at / ERROR: 对于 schema_migrations 关系,权限被拒绝。

5
以下是我的database.yml文件。
development:
     adapter:  postgresql
     host:     localhost
     encoding: unicode
     database: pepe_development
     pool:     5
     username: pepe
     password: password
     template: template0

当我执行db:migrate时,出现以下情况。
smaringanti-mbp:xpm smaringanti$ rake db:migrate 警告: 使用字符串作为Figaro配置。 ["admin", "user", "VIP"]被转换为“[\"admin\", \"user\", \"VIP\"]”。rake中止!ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: 错误:拒绝访问关系模式迁移:SELECT "schema_migrations".* FROM "schema_migrations" /Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in `async_exec'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in `exec_no_cache'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:138:in `exec_query'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in `block in log'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:in `log'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:891:in `select'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/querying.rb:36:in `find_by_sql'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:585:in `exec_queries'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:471:in `load'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:220:in `to_a'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:12:in `map'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:in `get_all_versions'/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:949:in `migrated'/Users/smaringanti/.rvm/gems/ruby-2.0

帮我一下。我正在尝试在本地主机上开发它。

2个回答

6

最终工作正常

以超级用户身份登录

ALTER TABLE schema_migrations OWNER TO menuquizz

\q

已登录为menuquizz

menuquizz_development=# \d
                    List of relations
 Schema |           Name           |   Type   |   Owner   
--------+--------------------------+----------+-----------
 public | .schema_migrations       | table    | denis
 public | menus                    | table    | menuquizz
 public | menus_id_seq             | sequence | menuquizz
 public | schema_migrations        | table    | menuquizz
(4 rows)

menuquizz_development=# \q

:~/Projects/menuquizz$ rake db:fixtures:load FIXTURES=menus
:~/Projects/menuquizz$ psql -U menuquizz menuquizz_development

Password for user menuquizz: 
psql (9.3.10)
Type "help" for help.

menuquizz_development=> select count(*) from menus;
 count 
-------
    45
(1 row)

OK

0

更新:

以超级用户身份登录:

ALTER TABLE schema_migrations OWNER TO menuquizz;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接