Rony M.
Rony M.

Reputation: 405

Can't migrate from Rails App to Heroku

The error:

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).

My Gemfile includes:

group :production do
gem 'pg', '~> 0.18.4'
gem 'rails_12factor', '~> 0.0.3'
end

I've already updated the bundler using "--without production" and all, but still getting the same error...

Upvotes: 1

Views: 446

Answers (2)

fool-dev
fool-dev

Reputation: 7777

ensure its version is at the minimum required by ActiveRecord

I have just pushed it into Heroku for testing using pg version 0.20.0

group :production do
  gem 'pg', '~> 0.20.0'
  gem 'rails_12factor'
end

Once you make this update in your group production of your Gemfile, ensure you run bundle install --without production (to update Gemfile.lock file), do a git add/commit cycle, then re-deploy to Heroku.

and then

heroku run rake db:migrate

Upvotes: 0

7urkm3n
7urkm3n

Reputation: 6321

Add pg in gemfile

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

Make sure Gemfile.lock updated and has pg.

Upvotes: 1

Related Questions