migratebundle: further migration functionality

Still to come: relations.

I think I prefer "unbeautify" for now. If we come back to it and can't understand the
code, let's change it...