add onsite migrate function for scafolding feature & minor code refactor