rails - 未配置开发数据库

时间:2012-12-27 01:10:52

标签: ruby-on-rails redmine

我正在尝试设置redmine并创建了一个愚蠢的简单database.yml,如下所示:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

当我运行rake db:create时,它会按预期创建开发数据库。但是,当我运行rake db:migrate时,它无法说:

development database is not configured!

如果db:migrate配置正确到足以创建数据库,为什么我不能运行database.yml

修改

我运行RAILS_ENV=development rake db:migrate并收到以下错误消息:

Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
NOTE: SourceIndex.new(hash) is deprecated; From /usr/share/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100 in `new'.
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.

2 个答案:

答案 0 :(得分:4)

尝试运行

RAILS_ENV=development rake db:migrate

此外,您可以使用--trace运行rake任务以找出问题

答案 1 :(得分:2)

检查config/environment.rb您正在运行的模式。如果内存服务,redmine默认以生产模式运行。