* Migrate the server upsert query to use database time This ensures that we are using consistent ideas of time regardless of the local time on each worker (for this query). * Fix insert part of the upsert query