From f1b7711d058365d7b496f707e9caa612a209a292 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 27 Oct 2020 16:44:51 +0000 Subject: [PATCH] Fix upload script to handle media that has never been accessed This is done by falling back to the `created_ts` if `last_access_ts` is null. Fixes #45. --- scripts/s3_media_upload | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/s3_media_upload b/scripts/s3_media_upload index 672c175..cddfb41 100644 --- a/scripts/s3_media_upload +++ b/scripts/s3_media_upload @@ -63,7 +63,7 @@ def run_update_db(postgres_conn, sqlite_conn, before_date): SELECT '', media_id, media_id FROM local_media_repository WHERE - last_access_ts < %s + COALESCE(last_access_ts, created_ts) < %s AND url_cache IS NULL """ @@ -71,7 +71,7 @@ def run_update_db(postgres_conn, sqlite_conn, before_date): SELECT media_origin, media_id, filesystem_id FROM remote_media_cache WHERE - last_access_ts < %s + COALESCE(last_access_ts, created_ts) < %s """ last_access_ts = int(before_date.timestamp() * 1000)