我目前正在浏览 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