migrate flatten