Refactor migration and load whole env while do migration

as title