fix migration query