From: Matt Harrison Date: 2009-01-12T03:56:25+09:00 Subject: Re: reccommended work flow for unit tests and databases in ruby Phlip wrote: > Matt Harrison wrote: > >> This sounds great, but I've read in several places (sorry can't find >> references) that you should create a new migration to make changes to >> an existing table. > > If you have not yet deployed a migration to your production site, you > can go back into it and tweak it. This is still within the inner TDD > cycle, because your tests will cover the new versions of the tables. > >> I've tried before to modify an existing migration but unless I totally >> wipe the DB, it doesn't take notice, as the schema version isn't >> incremented. > > Right - rake db:reset, and rake db:migrate:reset. > > Tweaking existing migrations before deploying them (such as adding each > field in a new table, as you TDD it) is a convenience that prevents your > migrate folder from filling up with many trivial variations. > Well I'm just getting into TDD and thats going well, but I did notice that when running rake:test, that it complains there are migrations that need to be run before the tests will be performed, even though the tests are running on a different database. Matt