Messed up blog DB

Well, it seems after years of schema upgrades, betas and life on MT's bleeding edge in general, the schema of my MT blog DB is messed up and causes spurious errors with MT4 that nobody else can reproduce.

Update: Ok, managed to get things cleaned up enough for beta 6 to upgrade the database properly. Cleaned out a bunch of old unused and unneeded blogs along with cleaning up old junk out of the mt_templatemap and mt_template tables. Once I did all that, everything worked as expected.

So here's what I tried.

Created a fresh new MT 3.35 database and used INSERT INTO [table] (...) SELECT ... FROM ... to repopulate the fresh database with the contents of the old one. But when I tried to get MT4 to upgrade the fresh database, I ended up with that same error at just before the end of the DB upgrade process

* Removing unused template maps... Error during upgrade: Can't call method "archive_type" on an undefined value at lib/MT/TemplateMap.pm line 99

Further attempts to get into MT just result in a blank error page.

So then I created a fresh MT4 database and use the same INSERT/SELECT method to copy data from the MT3.35 DB into the MT4 DB. This ended up being only partly successful. While everything appears to be intact, the dashboard is broken and the entry listing isn't sorted by date. Ok, that's fixed...the entry_authored_on and entry_authored_by fields weren't populated. Filling them in with appropriate values seems to have done the trick.

Will be interesting to see what happens when I start messing with templates and rebuilding things.