Rails: From Local MySQL to Heroku

I am working on a localhost application that is supported by a MySQL database. However, I would like to deploy to Heroku, which I read, is bacekd from PostGreSQL.

What is the best way to do this? I thought about this in the gemfile:

group :development do
 gem 'mysql2'
end

group :test do
 gem 'pg'
end

But how do I configure database.yml ? Is this the right approach?

+5
source share
1 answer

This page provides an example configuration:

Tutorial: Rails 3.2 with Ruby 1.9.3 on Heroku ยท RailsApps

This tutorial assumes that you have SQLite locally. If you want MySQL, just use in your Gemfile

group :development, :test do
  gem 'mysql2'
end
group :production do
  gem 'pg'
end

But how do I configure database.yml

- ; Heroku , .

( Heroku):

PostgreSQL . - .

( ):

bundle install --without production, . --without production pg gem; PostgreSQL (pg gem , PostgreSQL ).

+8

All Articles