Well, that was bloody irritating.
So, typo had some really huge schema changes within the last few days, going with single table inheritance for all articles, comments, trackbacks and the like. This apparently cleaned up the code something fierce, which I am very interested in taking a gander at. (ActiveRecord just doesn’t seem to lend itself to STI at all, so I’m really also wondering how it did so much happy stuff to the codebase. Ah well, I’m sure I’ll learn something—typo’s got really slick programmers.) However, those happy (massive) schema changes require a ton of reworking for existing typo installation databases.
So, I, like a really stupid person, just went and
svn uped, and then went to
rake migrate. Sadly, all is not well in migration-land, and the migration to version 18 tried to do something clever that required a model (
Content, the new one) that didn’t exist yet…
Content gets generated by the version 20 migration. Crap. That was the point at which I went and looked at the message with the update, and saw the “BACK UP YOUR DATABASE BEFORE MIGRATING” note. So I tried to migrate back down to version 17 (which worked, thankfully), backed up my database, and then tried to figure out what to do next.
After an hour and a half of randomly poking at the migrations and at the database (and having to restore from my backup about six times), I got the bright idea to update just a couple of svn versions at a time, and
rake migrate each time. Hopefully, the migration wouldn’t bork if the model file that expected the not-quite-there-yet table didn’t exist yet. Amazingly enough, after a restore from backup, it worked. About 15 minutes of
svn up and
rake migrate and my database was, miraculously enough, migrated. Happiness. Then I only had to spend another ten minutes wondering why it wouldn’t load up properly… since I hadn’t restarted the server yet, to update the running code to the new version I had just updated to.
The moral of the story: next time I go to upgrade software, I should be not sick.