summaryrefslogtreecommitdiff
path: root/src/sql/ext_mapping_upsert.sql
diff options
context:
space:
mode:
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