Search code examples
ruby-on-railsherokumigrationpg

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


Solution

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