(#3182) - avoid on-the-fly idb migrations

I was getting tired of the code complexity with
having to figure out whether `metadata.winningRev`
and `metadata.seq` were there or not. This adds
a new migration to get everything up to the modern
format.

So technically this migration isn't necessary, but I like
being able to remove a lot of complexity from the runtime
code, at the cost of a moderately-expensive migration
for existing databases.

I also went ahead and refactored the migration logic itself.
It's more readable now.