Moved migration out of task to be a callable function