运行rake db:migrate
后跟rake test:units
产生以下结果:
rake test:functionals
(in /projects/my_project)
rake aborted!
SQLite3::SQLException: index unique_schema_migrations already exists: CREATE UNIQUE INDEX "unique_schema_migrations" ON "ts_schema_migrations" ("version")
相关部分db/schema.rb
如下:
create_table "ts_schema_migrations", :id => false, :force => true do |t|
t.string "version", :null => false
end
add_index "ts_schema_migrations", ["version"], :name => "unique_schema_migrations", :unique => true
我不会在任何地方手动更改此索引,而是使用 Rails 的默认 SQLite3 适配器和全新的数据库。(也就是说,rm db/*sqlite3
之前运行rake db:migrate
没有帮助。)
该test:units
任务是否可能试图重新加载架构?如果是这样,为什么?它不应该识别架构已经是最新的吗?