multiwoven-integrations 0.35.1 → 0.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c6bf44e44a29c0ee851e748acf3ce7adf10495e413caaa6a5fa233155841abf
|
|
4
|
+
data.tar.gz: 50c9d53c1010c4656010e29a708b38be7c990ea81395ef85d3519998de68d03a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fb43e2a451ab824e9318fb94878eb2059f7cb0756ced03d37371b35b7c7ab0699574dba9b6ede033321e4082a295169ac074f94463e32ed4ed32e1123f8b856
|
|
7
|
+
data.tar.gz: 5c4c85224e29eec00ccf32c0be81ecc1cb97c2f58d06b33b3220c0ab79a7ccbd78e2eea8ad102fa7d67879873e1c1ff218932aba37ab08b2e72fd1bef6b0c21b
|
|
@@ -106,15 +106,19 @@ module Multiwoven::Integrations::Destination
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
sql = "INSERT INTO #{table_name} (#{col_list}) VALUES #{values_clauses.join(", ")}"
|
|
109
|
-
|
|
109
|
+
if primary_key.present?
|
|
110
|
+
sql += action.to_s == "destination_insert" ? build_safe_insert_clause(primary_key) : build_upsert_clause(columns, primary_key)
|
|
111
|
+
end
|
|
110
112
|
db.exec(sql)
|
|
111
113
|
end
|
|
112
114
|
|
|
113
|
-
def
|
|
114
|
-
|
|
115
|
+
def build_safe_insert_clause(primary_key)
|
|
116
|
+
" ON CONFLICT (#{quote_ident(primary_key)}) DO NOTHING"
|
|
117
|
+
end
|
|
115
118
|
|
|
119
|
+
def build_upsert_clause(columns, primary_key)
|
|
116
120
|
update_cols = columns.reject { |c| c.to_s == primary_key.to_s }
|
|
117
|
-
return
|
|
121
|
+
return build_safe_insert_clause(primary_key) if update_cols.empty?
|
|
118
122
|
|
|
119
123
|
set_clause = update_cols.map { |c| "#{quote_ident(c)} = EXCLUDED.#{quote_ident(c)}" }.join(", ")
|
|
120
124
|
" ON CONFLICT (#{quote_ident(primary_key)}) DO UPDATE SET #{set_clause}"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multiwoven-integrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.35.
|
|
4
|
+
version: 0.35.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Subin T P
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03
|
|
11
|
+
date: 2026-04-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|