multi_insert 1.0.1 → 1.0.2

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: a666e28505f82ffc01e2a87001af574ae537018d
4
- data.tar.gz: 11057d49e4b30e3b062c9c1454c04beea5a88192
3
+ metadata.gz: 4c1738f3565a4700e34dfe07e7a2e098f4ab386b
4
+ data.tar.gz: 7d25684fecb7dab48f5aae411c70704bdd57b162
5
5
  SHA512:
6
- metadata.gz: d41a9df50a203f9391d6c2328948760f6710bca115930a34ea7e72797557803864cf1aec4b616b9f2f5d095906c734db436325c6005b2fae980dff4b753129c8
7
- data.tar.gz: f35ab401b6eb3c61d8e0afd4c37429d0f1eb292c175c9cf9552882f915eba7c3e5f7226f45685afd84d39f917e72b5ae4f2fbabd60353926fc08d55ebb68b5c4
6
+ metadata.gz: d80094973356a6050dc32d3140a1793a1831e3e789b3dc7eff6da3041d885271cd639666d705e04f032846e142e6315f5474d4a6204ab44b527b4602b234e994
7
+ data.tar.gz: f4b75bc774a3d4dcbec95e9a99f754df15d8f9b4f37437a033effe0a007ad3cb95b41f6fafe8ee3ee9b84b2d274ec4659ec96d2a27a5eca1af18217e2cc1c232
@@ -14,10 +14,10 @@ module MultiInsert
14
14
  # Create an ON CONFLICT clause
15
15
  #
16
16
  # @param query [Query] the query.
17
- # @param column [String | Symbol] the column to watch for conflicts.
17
+ # @param column [String | Symbol | nil] the column to watch for conflicts.
18
18
  def initialize(query, column)
19
19
  @query = query
20
- @column = column.to_sym
20
+ @column = column.nil? ? nil : column.to_sym
21
21
  end
22
22
 
23
23
  # Ignore conflicting rows.
@@ -83,7 +83,7 @@ module MultiInsert
83
83
  #
84
84
  # @param column [String | Symbol] The column to watch for conflicts.
85
85
  # @return [Query::OnConflict] A conflict clause.
86
- def on_conflict(column)
86
+ def on_conflict(column = nil)
87
87
  ::MultiInsert::Query::OnConflict.new(self, column)
88
88
  end
89
89
 
@@ -34,8 +34,12 @@ module MultiInsert
34
34
  end
35
35
 
36
36
  def self.on_conflict(column)
37
- column = ActiveRecord::Base.connection.quote_column_name(column.to_s)
38
- "ON CONFLICT (#{column})"
37
+ if column.nil?
38
+ "ON CONFLICT"
39
+ else
40
+ column = ActiveRecord::Base.connection.quote_column_name(column.to_s)
41
+ "ON CONFLICT (#{column})"
42
+ end
39
43
  end
40
44
 
41
45
  def self.on_conflict_do_nothing(column)
@@ -1,4 +1,4 @@
1
1
  module MultiInsert
2
2
  # The version number for MultiInsert.
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_insert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nax
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler