Use custom migration type instead of type from external library
This MR switches the migration logic to use the Migration
type that we've defined ourselves.
This is largely preparatory work for the changes in #220 (closed) and does not change current functionally.