From b0a30e621b0a01e42955bf0ea79a679ec39d3454 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Mon, 27 Oct 2025 13:01:52 -0400 Subject: [PATCH] clear old relations on updating publications of documents --- appview/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appview/index.ts b/appview/index.ts index d7eee4de..4c537dd6 100644 --- a/appview/index.ts +++ b/appview/index.ts @@ -116,6 +116,11 @@ async function handleEvent(evt: Event) { publication: record.value.publication, document: evt.uri.toString(), }); + await supabase + .from("documents_in_publications") + .delete() + .neq("publication", record.value.publication) + .eq("document", evt.uri.toString()); if (docInPublicationResult.error) console.log(docInPublicationResult.error); } -- 2.51.2