fix some bugs about sql funcation name and migrat