首页 文章

执行“heroku db:migrate”并收到错误“Please install the postgresql adapter”

提问于
浏览
1

我正在尝试使用myoku db:使用mySQL数据库进行迁移,我收到了错误/建议:

请安装postgresql适配器: gem install activerecord-postgresql-adapter (pg不是捆绑包的一部分 . 将其添加到Gemfile . )

我尝试在我的gem文件中放入“gem install activerecord-postgresql-adapter”,但是当我运行bundle install时,我得到:

charlotte-dator:showwwdown holgersindbaek $ bundle install / Users / holgersindbaek / Projekter / Showwwdown / showwwdown / Gemfile:34:in evaluate': undefined local variable or method activerecord'for the(NameError)from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21 /lib/bundler/definition.rb:17:in build' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:138:in definition'from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:219:in install' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in send'from / Library /Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in run' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in invoke_task'from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21 /lib/bundler/vendor/thor.rb:263:in dispatch' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in start ' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/bin/bundle:13 from /usr/bin/bundle:19:in `load' from / usr / bin / bundle:19

希望你能帮忙 . 谢谢!

2 回答

  • 1

    将以下行添加到gemfile中(改为):

    gem 'pg'
    

    如果您不在开发中使用Postgres,则可以执行以下操作:

    gem 'pg', :group => :production
    
  • 1

    确保你推送到heroku的分支是master分支 .

    在我的情况下,我尝试了以上所有,它没有工作 . 当我推送我的git存储库时,我做了另一个错误,我没有推动master分支,而是另一个'命名'分支 . 因此,即使更新了gem文件等,我的更改也没有得到反映 .

相关问题