現在、Railstutorialを使用していますが、実行するとエラーが発生し続けますheroku run rake db:migrate
私はすでに何時間もオンラインで検索しました-エラーは一般的なようですが、提案された解決策のどれも違いをもたらさないようです、あなたの助けは非常にありがたいです!
エラーは
Connecting to database specified by DATABASE_URL
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)
gem install activerecord-postgresql-adapter
gemfileを実行して変更したところ、次のようになりました。
group :development do
gem 'rspec-rails', '2.6.1'
gem 'sqlite3', '~> 1.3.0'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
gem 'sqlite3', '~> 1.3.0'
end
group :production do
gem "pg"
end
コミットした後、私は走っbundle install --without production
てgit push heroku
私のdatabase.ymlは次のようになります:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000