mirror of
https://github.com/derf/travelynx
synced 2024-12-02 17:29:11 +00:00
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:
parent
564f2fb354
commit
9d4f3f8ce1
1 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue