refactor code: add migrate