[code] move the migration loop back in the js