From 6c3559c51bf01ab10346d575e8b26903028c7251 Mon Sep 17 00:00:00 2001
From: Jonathan Bradley <jcb@pikum.xyz>
Date: Wed, 10 Dec 2025 15:01:13 -0500
Subject: pke-at: import, re-import avoid duplicates

---
 src/sql/ext_mapping_upsert.sql | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 src/sql/ext_mapping_upsert.sql

(limited to 'src/sql/ext_mapping_upsert.sql')

diff --git a/src/sql/ext_mapping_upsert.sql b/src/sql/ext_mapping_upsert.sql
new file mode 100644
index 0000000..db9f44b
--- /dev/null
+++ b/src/sql/ext_mapping_upsert.sql
@@ -0,0 +1,7 @@
+INSERT INTO [ext_mapping] (source_id,id_external_integer,uuid)
+	VALUES('%i','%i','%s')
+		ON CONFLICT(source_id,id_external_integer) DO UPDATE SET
+			uuid=excluded.uuid
+			,is_deleted=0
+			,modification_dt=unixepoch('now')
+		WHERE source_id=excluded.source_id AND id_external_integer=excluded.id_external_integer
-- 
cgit v1.2.3

