Update database queries to include last_connection field