Handling changes in models in migrations

Hello Rails list,

I had a question regarding dealing with changes to models and migrations. When a model has its name changed or is deleted in a newer migration this has the possibility of breaking an earlier migration that believes that model still exists but doesn't.

How have been handling this? The Rails wiki suggests to not use application models in a migration or try to create temp models to handle this case. However, on a project our team has been working on the number of migrations that would have to be touched to fix this is quite unwieldy.

How have people here been trying to deal with this situation? Don't get into it? :slight_smile: Some magic ruby-fu to convert all bad migrations into a good one? Ignore it and deal with the problem when it happens?

Cheers, Alain

You should be doing this from the start then. Or, just remove the old migrations.