PG::InsufficientPrivilege at / ERROR: permission denied for relation schema_migrations
以下是我的
1 2 3 4 5 6 7 8 9 | development: adapter: postgresql host: localhost encoding: unicode DATABASE: pepe_development pool: 5 username: pepe password: password template: template0 |
当我做
smaringanti-mbp:xpm smaringanti$ rake db:migrate WARNING: Use strings
for Figaro configuration. ["admin","user","VIP"] was converted to
"[\"admin\", \"user\", \"VIP\"]". rake aborted!
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR:
permission denied for relation schema_migrations : 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:inasync_exec' exec_no_cache'
/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
/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
block in exec_query' block in log'
/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
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in
instrument' log'
/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
/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' select'
/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
/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' 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
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/querying.rb:36:infind_by_sql' exec_queries'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:585:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:471:in
load' to_a'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation.rb:220:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:12:in
map' get_all_versions'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:949:in
migrated' ran?'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:954:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in
block in runnable' reject'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in
runnable' migrate'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:908:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in
up' migrate'
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:in
block (2 levels) in eval''
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/bin/ruby_executable_hooks:15:in
/Users/smaringanti/.rvm/gems/ruby-2.0.0-p643@pepe/bin/ruby_executable_hooks:15:in
`' Tasks: TOP => db:migrate (See full trace by running task with
--trace)
帮帮我。 我正在尝试在我的localhost上开发它
终于工作得很好
以超级用户身份登录
1 2 3 | ALTER TABLE schema_migrations TO OWNER menuquizz \q |
记录为menuquizz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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 |
更新:
以超级用户身份登录:
1 | ALTER TABLE schema_migrations OWNER TO menuquizz; |