activerecord-insert_many 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f3a11efa931742fc96cb84de9f2f605fd9e1e42
4
- data.tar.gz: e12ef9f2fac223018001c3c6cb1e09d726e54eb4
3
+ metadata.gz: f7fc9b46ec30b57c6cdb792933adc263f8ad220f
4
+ data.tar.gz: a73452740ba07ac8e9df7b4fedd0c5a6cc71963c
5
5
  SHA512:
6
- metadata.gz: 2e107a6951bd83c3fd519beccac395f6bbc3f89935c01c361601a00dd4784748a64835d8caa088f1aff4da9d266d431b9fe3a43ec3298339bf3bfdf138aeeedf
7
- data.tar.gz: 48e70bc7be5c1027b80c45c8fb50c45a06cc1ae2fd65061a5e753718ea7db5acabc257cc1f8c6d63a1919543b2934b43920cdcfd25184135065539e20efa022a
6
+ metadata.gz: b58508449aaa677fa96585967271755c69bcbd5306a76e4b4cc4737bab2f65a62603dc2ff00d7536d5915d50de79511bd8e559a60194145807eed28184581655
7
+ data.tar.gz: 08986ce8976280d214240cc20c8c219e7bf6bbcd86a88d0e972f1a35b39476d3f05105c1d0046a8101318d1f9b408e003eea1d59d190e22f91847c758841037b
@@ -76,7 +76,9 @@ module ActiveRecord
76
76
  if conflict_do == :nothing
77
77
  sql << " DO NOTHING"
78
78
  else
79
- sql << " DO UPDATE SET #{(key_list - conflict_columns).map { |key| "#{key} = excluded.#{key}" }.join(", ")}"
79
+ primary_keys = Array(schema_cache.primary_keys(table_name)).map(&method(:quote_column_name))
80
+ updatable_keys = key_list - conflict_columns - primary_keys
81
+ sql << " DO UPDATE SET #{updatable_keys.map { |key| "#{key} = excluded.#{key}" }.join(", ")}"
80
82
  end
81
83
  end
82
84
 
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module InsertMany
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-insert_many
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Booth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-05-21 00:00:00.000000000 Z
12
+ date: 2018-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord