Here’s the problem… Typo has ~35 migrate scripts. Script 3 makes a
minor schema change, then migrates data to the new schema. For
add_column :articles, :user_id, :integer Article.find(:all).each do |a| a.user=User.find_by_name(a.author) a.save end
This makes sense… except that a revision 35 model has been
instantiated on a revision 3 schema! This, of course, barfs all sorts
of errors about missing tables, missing rows, etc.
How can this be fixed? Do I need to rewrite the models so that they
support ALL schemas this database has ever had? That sounds tedious.
Without this, however, upgrading typo should require one checkout for
each schema change! Otherwise, models and schemas will not necessarily
match. You’ll be relying on luck for your migration to succeed
(assuming you don’t do a careful analysis first, which I’m betting none
of you do… :).
This problem seems to make migration scripts only useful for minor
upgrades (Typo 2.5.5 -> 2.6.0)! Am I missing something here? Thanks,