add query migrate function