how to drop table and recreate the table using migrate

rake db:migrate VERSION=0 rake db:migrate

good luck! Tim

> rake db:migrate VERSION=0 > rake db:migrate >

It doesn't work. I don't know why. It seems I have to go to mysql to drop the entire database.

If something unexpected happens, the rake migrate task will leave it up to you to clean up manually. It's not smart enough to recover from the many different things that can go wrong.

You can run your migrations first as

rake db:migrate --dry-run --trace

That'll catch some possible errors before running the migration for real.

> rake db:migrate VERSION=0 > rake db:migrate

Yan wrote:

It doesn't work.

It probably requires effective self.down methods. I suspect that _some_ people slack off on those. Not _me_, of course!

> > rake db:migrate VERSION=0 > > rake db:migrate

> It doesn't work. I don't know why. It seems I have to go to mysql to > drop the entire database.If something unexpected happens, the rake migrate task will leave it up to you to clean up manually. It's not smart enough to recover from the many different things that can go wrong.

Yeah - that's a bit of an issue if you don't capture the correct steps to migrate back down. Personally, I check I can migrate up and back down each step of the way (unless data is being destroyed in the migration, which make them very scary).

You can run your migrations first as

rake db:migrate --dry-run --trace

That'll catch some possible errors before running the migration for real.

Nice tip.

I would also recommend looking at ":force=>true" whenever you are creating a new table.