migrations: Add `WithMigrationLog`
Created by: efritz
Pulled from #29831. This PR splits the attempt of a migration and its bookkeeping. This will be necessary for the full effort to later be able to add migration logs for other automatic repair actions (e.g. dropping an invalid index before re-running the migration).