Support transactions in Migrator.run

This pull request is a port of pull request #9416 on Rails 4.