scripts and codes for migration