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)