Move query alter code to include.