From 9f14bd95ec604294fd3801849d7c9911d4478ad3 Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Wed, 29 May 2024 16:27:12 +0200 Subject: [PATCH] Adjust harvest code to delete removed events from the right table --- backend/src/sync/harvest/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/sync/harvest/mod.rs b/backend/src/sync/harvest/mod.rs index 2389ccdfb..2345c6f1b 100644 --- a/backend/src/sync/harvest/mod.rs +++ b/backend/src/sync/harvest/mod.rs @@ -188,7 +188,7 @@ async fn store_in_db( let segments = segments.into_iter().map(Into::into).collect::>(); // We upsert the event data. - upsert(db, "events", "opencast_id", &[ + upsert(db, "all_events", "opencast_id", &[ ("opencast_id", &opencast_id), ("state", &EventState::Ready), ("series", &series_id), @@ -219,7 +219,7 @@ async fn store_in_db( HarvestItem::EventDeleted { id: opencast_id, .. } => { let rows_affected = db - .execute("delete from events where opencast_id = $1", &[&opencast_id]) + .execute("delete from all_events where opencast_id = $1", &[&opencast_id]) .await?; check_affected_rows_removed(rows_affected, "event", &opencast_id); removed_events += 1;