From d361bb7806791b63702e55e3c86523c93436062f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 9 Sep 2018 18:11:13 +0200 Subject: DB: Fix update_path_if_greater not working for existing rows Signed-off-by: Florian Pritz --- lib/App/BorgRestore/DB.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm index 010f916..3c9e0fb 100644 --- a/lib/App/BorgRestore/DB.pm +++ b/lib/App/BorgRestore/DB.pm @@ -171,7 +171,7 @@ method add_path($archive_id, $path, $time) { method update_path_if_greater($archive_id, $path, $time) { $self->_insert_path($archive_id, $path, $time); - my $st = $self->{dbh}->prepare_cached('update files set `'.$archive_id.'` = ? where `path` = ? and `'.$archive_id.'` < ?'); + my $st = $self->{dbh}->prepare_cached('update files set `'.$archive_id.'` = ? where `path` = ? and (`'.$archive_id.'` < ? or `'.$archive_id.'` is null)'); $st->execute($time, $path, $time); } -- cgit v1.2.3-24-g4f1b