summaryrefslogtreecommitdiff
path: root/src/sql/ext_mapping_upsert.sql
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-12-10 15:01:13 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-12-10 15:01:13 -0500
commit6c3559c51bf01ab10346d575e8b26903028c7251 (patch)
treea15699c99b5a5374a9a45a9d24cb407a7711b26c /src/sql/ext_mapping_upsert.sql
parent5807565be93e8b813627fb8f52747d8d6b8a1504 (diff)
pke-at: import, re-import avoid duplicatesHEADmaster
Diffstat (limited to 'src/sql/ext_mapping_upsert.sql')
-rw-r--r--src/sql/ext_mapping_upsert.sql7
1 files changed, 7 insertions, 0 deletions
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