After Rails 3 upgrade rake db:test:prepare not working?
I have just gone through the process of upgrading a Rails 2.3.11 app that uses Tes开发者_StackOverflow中文版t Unit to Rails 3.1.rc4 and I have now set up rspec-rails 2.6.1.
I also switch the test connection in database.yml
to use sqlite instead of postgres.
I can run rake db:migrate
and db:test:prepare
all day, but in my model tests I get "Could not find table 'model_name'".
Has anyone else ran into this?
I did encounter this before. Try rebuilding it from scratch:
rake db:drop RAILS_ENV=test
rake db:create RAILS_ENV=test
rake db:migrate RAILS_ENV=test
What does select * from schema_migrations show you? Verify that the migrations you expect have all actually been stored. If you know which migration failed you can use rake db:migrate:redo VERSION=<VERSION>
Apologies for not being a comment. StackOverflow's "can't comment until 50" policy seems a bit backwards :)
精彩评论