Resolve the right database connection.

This fixes the behavior already described in #2784. When you migrate --pretend and you have different database connections it simply does not pretend, but executes the queries, because Migrator uses the wrong database connection. This change seems to fix this.