From: Dietmar Maurer Date: Mon, 11 Jun 2018 06:38:22 +0000 (+0200) Subject: sync_userprefs_db: fix merge function X-Git-Url: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff_plain;h=286bc5908efc04e41d601d998d22fb68e517ac65;hp=ecb78445ab94d9ac9189559cc6d8e6096cf388fa sync_userprefs_db: fix merge function --- diff --git a/PMG/Cluster.pm b/PMG/Cluster.pm index 8517984..5eb41b5 100644 --- a/PMG/Cluster.pm +++ b/PMG/Cluster.pm @@ -797,7 +797,7 @@ sub sync_userprefs_db { my $merge_sth = $dbh->prepare( "INSERT INTO UserPrefs (PMail, Name, Data, MTime) " . - 'VALUES (?, ?, ?, 0) ' . + 'VALUES (?, ?, ?, ?) ' . 'ON CONFLICT (PMail, Name) DO UPDATE SET ' . # Note: MTime = 0 ==> this is just a copy from somewhere else, not modified 'MTime = CASE WHEN excluded.MTime >= UserPrefs.MTime THEN 0 ELSE UserPrefs.MTime END, ' . @@ -806,7 +806,7 @@ sub sync_userprefs_db { my $mergefunc = sub { my ($ref) = @_; - $merge_sth->execute($ref->{pmail}, $ref->{name}, $ref->{data}); + $merge_sth->execute($ref->{pmail}, $ref->{name}, $ref->{data}, $ref->{mtime}); }; return $sync_generic_mtime_db->($dbh, $rdb, $ni, 'UserPrefs', $selectfunc, $mergefunc);