I’ve noticed an annoying problem with Rails 4, and was wondering if folks had also seen this in action or had solutions.
Rails 4’s test helper will automatically maintain the database schema for tests, which means you don’t need to run rake db:test:load after migrations, Rails just migrates the test database for you. The problem comes if you roll back a migration and then re-run the migration, it seems that Rails doesn’t reflect the change without performing the db:test:load command. Since this functionality is going to be deprecated in future, I’m wondering how folks handle this problem.
One solution I can see other than just creating a new migration to fix your previous migration is to rename your migration file with a new timestamp. 20140714201834_create_things.rb → 20140714201835_create_things.rb. This will force the schema version to change and the tests will load this new version instead.
@frank_west_iii, I think I’m way too lazy to edit that timestamp every time, but that is by far the best solution of any of the stuff I’ve read or tried to think up myself. Thanks for the idea!
@derekprior, I think the functionality would be good (assure that development and test are in sync) if it consistently worked, but now that I’m used to debugging spring-related issues this is now one of the most frequent places where I miss a change that’s not due to a problem with the code as it stands in my app.