1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback :checkout, :before, ->(conn) do
6 # If the database connection is in a time zone other than UTC,
7 # "timestamp" values don't behave as desired.
9 # For example, ['select now() > ?', Time.now] returns true in time
10 # zones +0100 and UTC (which makes sense since Time.now is evaluated
11 # before now()), but false in time zone -0100 (now() returns an
12 # earlier clock time, and its time zone is dropped when comparing to
13 # a "timestamp without time zone").
14 conn.execute("SET TIME ZONE 'UTC'")