title: Rails: Change my development database from sqlite to postgresql
body: <p>I've got a Rails app which currently uses sqlite in development and postgresql in production on Heroku. However, I'm trying to change this so that I use postgresql in development.</p>
  
  <p>My Gemfile currently looks like this:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  gem 'rails',                '4.2.2'
  gem 'bcrypt',               '3.1.7'
  gem 'bootstrap-sass',       '3.2.0.0'
  gem 'sass-rails',           '5.0.2'
  gem 'uglifier',             '2.5.3'
  gem 'coffee-rails',         '4.1.0'
  gem 'jquery-rails',         '4.0.3'
  gem 'jquery-ui-rails', '~&gt; 4.2.1'
  gem 'turbolinks',           '2.3.0'
  gem 'jquery-turbolinks'
  gem 'jbuilder',             '2.2.3'
  gem 'sdoc',                 '0.4.0', group: :doc
  gem 'chart-js-rails'
  gem 'gon'
  gem 'lodash-rails'
  
  group :development, :test do
    #gem 'sqlite3',     '1.3.9'
    gem 'pg',             '0.17.1'
    gem 'byebug',      '3.4.0'
    gem 'web-console', '2.0.0.beta3'
    gem 'spring',      '1.1.3'
  end
  
  group :production do
    gem 'pg',             '0.17.1'
    gem 'rails_12factor', '0.0.2'
    gem 'puma',           '3.1.0'
  end
  </code></pre>
  
  <p>So in the development group I've replaced the <code>'sqlite3' gem</code> with the <code>'pg' gem</code>.</p>
  
  <p>I've modified the database.yml to look something like this:</p>
  
  <pre><code>default: &amp;default
    adapter: postgresql
    host: localhost
    pool: 5
    timeout: 5000
  
  development:
    &lt;&lt;: *default
    database: abc_development
    username: abc
    password: password1
  
  test:
    &lt;&lt;: *default
    database: abc_test
    username: abc
    password: password1
  
  production:
    &lt;&lt;: *default
    database: abc_production
    username: abc
    password: password1
  </code></pre>
  
  <p>I've executed <code>bundle install --without production</code> however, when I try <code>bundle exec rake db:create db:migrate</code> I receive the following error:</p>
  
  <pre><code>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).
  </code></pre>