【发布时间】:2017-10-18 22:04:27
【问题描述】:
宝石文件:
source 'https://rubygems.org'
gem 'rails', '5.0.1'
gem 'bcrypt', '3.1.11'
gem 'puma', '3.4.0'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.4.1'
gem 'bootstrap-sass', '3.3.6'
gem 'unicorn'
group :development, :test do
gem 'sqlite3', '1.3.12'
gem 'byebug', '9.0.0', platform: :mri
end
group :development do
gem 'web-console', '3.1.1'
gem 'listen', '3.0.8'
gem 'spring', '1.7.2'
gem 'spring-watcher-listen', '2.0.0'
end
group :test do
gem 'rails-controller-testing', '0.1.1'
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
数据库.yml:
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# 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:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
运行 rake db:migrate 时迁移失败。 尝试使用 RAILS_ENV=development 将环境变量设置为 development 仍然失败。我在生产中使用 postgres,因为 heroku 提供了 postgres。gem 文件和 database.yml 都给出了。
编辑: 我尝试将 repo 克隆到另一台机器上并尝试它工作正常。
【问题讨论】:
-
谢谢大家,问题出在我的本地机器上,因为我最近安装了没有 brew 的 Postgres。一旦我卸载了 rhat 并重新启动,迁移就成功了。
标签: ruby-on-rails database-migration