ruby on rails 4 - convert from sqlite3 to postgresql -
i trying convert rails app built sqlite3 in order use heroku, need use postgresql. have tried every suggestion found online , here on stackoverflow without luck. can please me?
this current database.yml:
# sqlite version 3.x # gem install sqlite3 # # ensure sqlite 3 gem defined in gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 # warning: database defined "test" erased , # re-generated development database when run "rake". # not set db same development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3 my current gemfile:
source 'https://rubygems.org' # bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.1' # use sqlite3 database active record gem 'sqlite3' # use scss stylesheets gem 'sass-rails', '~> 5.0' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .coffee assets , views gem 'coffee-rails', '~> 4.1.0' # see https://github.com/rails/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby gem 'devise' gem 'simple_form' gem 'paperclip' # use jquery javascript library gem 'jquery-rails' # turbolinks makes following links in web application faster. read more: https://github.com/rails/turbolinks gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates api under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc # use activemodel has_secure_password # gem 'bcrypt', '~> 3.1.7' # use unicorn app server # gem 'unicorn' # use capistrano deployment # gem 'capistrano-rails', group: :development group :development, :test # call 'byebug' anywhere in code stop execution , debugger console gem 'byebug' # access irb console on exception pages or using <%= console %> in views gem 'web-console', '~> 2.0' # spring speeds development keeping application running in background. read more: https://github.com/rails/spring gem 'spring' end my gemfile.lock:
gem remote: https://rubygems.org/ specs: actionmailer (4.2.1) actionpack (= 4.2.1) actionview (= 4.2.1) activejob (= 4.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) actionpack (4.2.1) actionview (= 4.2.1) activesupport (= 4.2.1) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) actionview (4.2.1) activesupport (= 4.2.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) activejob (4.2.1) activesupport (= 4.2.1) globalid (>= 0.3.0) activemodel (4.2.1) activesupport (= 4.2.1) builder (~> 3.1) activerecord (4.2.1) activemodel (= 4.2.1) activesupport (= 4.2.1) arel (~> 6.0) activesupport (4.2.1) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.0) bcrypt (3.1.10) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) byebug (4.0.5) columnize (= 0.9.0) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.7) climate_control (>= 0.0.3, < 1.0) coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.9.1.1) columnize (0.9.0) debug_inspector (0.0.2) devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) responders thread_safe (~> 0.1) warden (~> 1.2.3) erubis (2.7.0) execjs (2.5.2) globalid (0.3.5) activesupport (>= 4.1.0) i18n (0.7.0) jbuilder (2.2.13) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) jquery-rails (4.0.3) rails-dom-testing (~> 1.0) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.2) loofah (2.0.1) nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.4.3) mini_portile (0.6.2) minitest (5.6.0) multi_json (1.11.0) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) orm_adapter (0.5.0) paperclip (4.2.1) activemodel (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types rack (1.6.0) rack-test (0.6.3) rack (>= 1.0) rails (4.2.1) actionmailer (= 4.2.1) actionpack (= 4.2.1) actionview (= 4.2.1) activejob (= 4.2.1) activemodel (= 4.2.1) activerecord (= 4.2.1) activesupport (= 4.2.1) bundler (>= 1.3.0, < 2.0) railties (= 4.2.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.6) activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.2) loofah (~> 2.0) railties (4.2.1) actionpack (= 4.2.1) activesupport (= 4.2.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) rdoc (4.2.0) responders (2.1.0) railties (>= 4.2.0, < 5) rest-client (1.6.7) mime-types (>= 1.16) sass (3.4.13) sass-rails (5.0.3) railties (>= 4.0.0, < 5.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (~> 1.1) sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) sequel (3.20.0) simple_form (3.1.0) actionpack (~> 4.0) activemodel (~> 4.0) sinatra (1.0) rack (>= 1.0) spring (1.3.4) sprockets (3.0.1) rack (~> 1.0) sprockets-rails (2.2.4) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) sqlite3 (1.3.10) taps (0.3.24) rack (>= 1.0.1) rest-client (>= 1.4.0, < 1.7.0) sequel (~> 3.20.0) sinatra (~> 1.0.0) thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (2.7.1) execjs (>= 0.3.0) json (>= 1.8.0) warden (1.2.3) rack (>= 1.0) web-console (2.1.2) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) platforms ruby dependencies byebug coffee-rails (~> 4.1.0) devise jbuilder (~> 2.0) jquery-rails paperclip rails (= 4.2.1) sass-rails (~> 5.0) sdoc (~> 0.4.0) simple_form spring sqlite3 taps (~> 0.3.22) turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) now getting error:
remote: remote: gem files remain installed in /tmp/build_efbe3fb311a683f3c20ccebf588383f4/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 inspection. remote: results logged /tmp/build_efbe3fb311a683f3c20ccebf588383f4/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out remote: installing tilt 1.4.1 remote: installing bcrypt 3.1.10 remote: error occurred while installing sqlite3 (1.3.10), , bundler cannot remote: continue. remote: make sure `gem install sqlite3 -v '1.3.10'` succeeds before bundling. remote: ! remote: ! failed install gems via bundler. remote: ! remote: ! detected sqlite3 gem not supported on heroku. remote: ! https://devcenter.heroku.com/articles/sqlite3
you need include postgresql gem gemfile
gem 'pg'
i recommend using rails 12 factor app gem. precompiles assets , gets ready heroku automatically when app used in production environment:
gem 'rails_12factor', group: :production
change production part of database config to:
production: adapter: postgresql pool: 5 timeout: 5000
i wrote short blog on how start using rails heroku more information if helps. here's quick link great guide heroku if haven't seen too.
as you're using postresql in production environment , because heroku doesn't support sqlite. must change gemfile install sqlite development , test environments (unless want them use postgres too).
group :development, :test gem 'sqlite3' end
Comments
Post a Comment