无法从 Rails 应用程序迁移到 Heroku
Can't migrate from Rails App to Heroku
错误:
rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the
gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its
version is at the minimum required by ActiveRecord).
我的 Gemfile 包括:
group :production do
gem 'pg', '~> 0.18.4'
gem 'rails_12factor', '~> 0.0.3'
end
我已经使用“--without production”更新了捆绑器,但仍然出现同样的错误...
在 gemfile 中添加 pg
group :production do
gem 'pg', '~> 0.21'
gem 'rails_12factor'
end
#Terminal
>$ bundle install
>$ git add .
>$ git commit -m 'pg added'
>$ git push heroku master
确保 Gemfile.lock 更新并 pg
。
ensure its version is at the minimum required by ActiveRecord
我刚刚将它推入 Heroku 以使用 pg 版本进行测试 0.20.0
group :production do
gem 'pg', '~> 0.20.0'
gem 'rails_12factor'
end
在 Gemfile 的小组制作中进行此更新后,确保 运行 bundle install --without production
(更新 Gemfile.lock 文件),执行 git add/commit 循环,然后重新部署到 Heroku。
然后
heroku run rake db:migrate
错误:
rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the
gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its
version is at the minimum required by ActiveRecord).
我的 Gemfile 包括:
group :production do
gem 'pg', '~> 0.18.4'
gem 'rails_12factor', '~> 0.0.3'
end
我已经使用“--without production”更新了捆绑器,但仍然出现同样的错误...
在 gemfile 中添加 pg
group :production do
gem 'pg', '~> 0.21'
gem 'rails_12factor'
end
#Terminal
>$ bundle install
>$ git add .
>$ git commit -m 'pg added'
>$ git push heroku master
确保 Gemfile.lock 更新并 pg
。
ensure its version is at the minimum required by ActiveRecord
我刚刚将它推入 Heroku 以使用 pg 版本进行测试 0.20.0
group :production do
gem 'pg', '~> 0.20.0'
gem 'rails_12factor'
end
在 Gemfile 的小组制作中进行此更新后,确保 运行 bundle install --without production
(更新 Gemfile.lock 文件),执行 git add/commit 循环,然后重新部署到 Heroku。
然后
heroku run rake db:migrate