railsbridge / docs

Curriculum for RailsBridge workshops
docs.railsbridge.org
Other
3.44k stars 452 forks source link

"heroku run rails db:migrate" fails on Windows 10 #621

Open ciarancumiskey opened 7 years ago

ciarancumiskey commented 7 years ago

Hi, I'm following your Installfest guide and I'm trying to deploy my first Ruby on Rails app to Heroku. However, I've hit a wall when it comes to migrating the database, and this seems to be the issue: Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Addgem 'sqlite3'to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

The Gemfiles are apparently disregarded because they were edited on Windows. What can I do?

jnicho02 commented 7 years ago

Heroku won't do sqlite, only (mainly) postgres. Set the production environment to pg in your Gemfile

group :development, :test do
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
end
group :production do
  gem 'pg'
  gem 'rails_12factor'
end
jnicho02 commented 7 years ago

It does actually say this is the tutorial now https://shielded-mesa-4358.herokuapp.com/intro-to-rails/deploying_to_heroku in Step 2, so issue could be closed

mjibrower commented 6 years ago

I got the same error message, and tried this solution. Unfortunately, it didn't work for me, and the tutorial here: http://docs.railsbridge.org/installfest/deploy_a_rails_app hasn't been changed yet, so I'm adding the solution that did work for me to this thread.

Following this Stack Overflow post: https://stackoverflow.com/questions/48201361/rails-application-using-postgres-adapter-cant-activate-pg, I added the minimum version of the pg gem to the Gemfile, like this:

group :production do
  gem 'pg', '~> 0.18'

end

And that worked. :-)

jeanettehead commented 6 years ago

Fixed in this pull request: https://github.com/railsbridge/docs/pull/632