fix upsert call signature; move implementations of Query#update and Query#upsert to be adjacent