Ensure that database timezone matches IRIS time zone

All travelynx and IRIS timestamps are Europe/Berlin. And the DateTime objects
know that they are Europe/Berlin. However, when inserting into a timestamp with
time zone column, Mojo::Pg or one of the backend DBI/DBD libraries does not
respect the time zone. So, UTC+1 or UTC+2 timestamps are treated as UTC+0,
resulting in major mayhem.
This commit is contained in:
Daniel Friesel 2021-09-03 20:24:54 +02:00
parent 564f2fb354
commit 9d4f3f8ce1
No known key found for this signature in database
GPG key ID: 100D5BFB5166E005

View file

@ -369,6 +369,15 @@ sub startup {
state $pg
= Mojo::Pg->new("postgresql://${user}\@${host}:${port}/${dbname}")
->password($pw);
$pg->on(
connection => sub {
my ( $pg, $dbh ) = @_;
$dbh->do("set time zone 'Europe/Berlin'");
}
);
return $pg;
}
);