migratebundle: relation inference

The testing is a little on the light side, but has been manually verified against all known bundles
that we need to migrate.

I stole this logic from juju-core itself, so I don't think so :)