Uploading to Heroku DB rake:migrate problem

后端 未结 2 1380
不思量自难忘°
不思量自难忘° 2021-01-15 23:29

having a problem with a heroku upload. Quite new to RoR so please excuse the beginners question.

I\'m following the Ruby on Rails Tutorial (http://ruby.railstutorial

相关标签:
2条回答
  • 2021-01-16 00:13

    By default, a new Rails application is configured to use the SQLite3 database. Heroku doesn't support SQLite3, you must use PostgreSQL.

    You have two alternatives:

    1. Keep using SQLite3 in development and test, and switch to PostgreSQL in production.
    2. Switch to PostgreSQL

    Either ways, you need to add the pg gem to your Gemfile (assuming you are using Rails 3) and remove sqlite3.

    # Gemfile
    gem 'pg'
    

    If you want to use Sqlite3 in development and test

    # Gemfile
    group :development, :test do
      gem 'sqlite3'
    end
    
    group :production do
      gem 'pg'
    end
    

    You might also need to change your database.yml configuration accordingly.

    0 讨论(0)
  • 2021-01-16 00:24

    Not quite the answer Simone, but after more digging, the answer finally came up. I needed to do the following:

    In the gemfile, I needed to change gem 'sqlite3' to:

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

    and then I needed to heroku create --stack cedar.

    Thanks for your help everyone regardless, and I hope this helps someone in the future.

    0 讨论(0)
提交回复
热议问题