refs #2572: Various enhancements and fixes for the migrations

Reusable classes and utilities.
Fixed issues with tests.