activerecord-spanner-adapter 1.5.0 → 1.5.1

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
  SHA256:
3
- metadata.gz: 4b10ee1d169ad72da934b5d726114d5b9ac215103c54b607a0fe0c18b2ed4876
4
- data.tar.gz: 3a2e65fd406507987da6a38cbcc38130da9a3200e7ad1f2b5909701916903ab8
3
+ metadata.gz: 73df0f7ee319edb7461b0fa60f8f8b611b38d798de2c0caf20a9c7d6796a7a85
4
+ data.tar.gz: 9dedd540069c5bc85d458008c20e48b9b550a75388a1f4d48b1b29b34bb689d4
5
5
  SHA512:
6
- metadata.gz: 1a842880cf43a9316cb76dba5a9ef0ecf576db7102a1d03a9ecd14308232801bb296701e6b8d1506a78d7895b61eec14f7e9b887e1d44dc075ba576076c2a6c5
7
- data.tar.gz: c2c9af94b3d25a19098edfe18c2bb479826ec6996e76ec0c8a3e50280988a0aee694decb8df6452d1a1bb2bee6be1e8338ace5f4bf588d96fa6781de44c13f74
6
+ metadata.gz: faac93588f6e703f183a773caf553d61b64370439093ac27a7d1a4893f6d887c887fbf1be9082baf78bb81e2c23b24f45a1e4053672e386595ff95c0980a0c4b
7
+ data.tar.gz: 4d6061c3daf7760d3015a33b52a41354f6bafa21b594a0c2b44852ae928935e1b2e23421ce417de2e65eecdc56de0890d97d0321e07fd3a3c3c104cf56856c88
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.5.0"
2
+ ".": "1.5.1"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.5.1 (2023-12-12)
4
+
5
+ #### Bug Fixes
6
+
7
+ * more permissive arg passthrough for insert_all and upsert_all ([#283](https://github.com/googleapis/ruby-spanner-activerecord/issues/283))
8
+
3
9
  ### 1.5.0 (2023-11-03)
4
10
 
5
11
  #### Features
@@ -33,6 +33,12 @@ module ActiveRecord
33
33
  assert_raise(NotImplementedError) { Author.insert_all(values) }
34
34
  end
35
35
 
36
+ def test_insert
37
+ value = { id: Author.next_sequence_value, name: "Alice" }
38
+
39
+ assert_raise(NotImplementedError) { Author.insert(value) }
40
+ end
41
+
36
42
  def test_insert_all!
37
43
  values = [
38
44
  { id: Author.next_sequence_value, name: "Alice" },
@@ -85,6 +91,22 @@ module ActiveRecord
85
91
  assert_equal "Carol", authors[2].name
86
92
  end
87
93
 
94
+ def test_upsert
95
+ Author.create id: 1, name: "David"
96
+ authors = Author.all.order(:name)
97
+ assert_equal 1, authors.length
98
+ assert_equal "David", authors[0].name
99
+
100
+ value = { id: 1, name: "Alice" }
101
+
102
+ Author.upsert(value)
103
+
104
+ authors = Author.all.order(:name)
105
+
106
+ assert_equal 1, authors.length
107
+ assert_equal "Alice", authors[0].name
108
+ end
109
+
88
110
  def test_upsert_all
89
111
  Author.create id: 1, name: "David"
90
112
  authors = Author.all.order(:name)
@@ -67,11 +67,11 @@ module ActiveRecord
67
67
  _buffer_record values, :insert_or_update
68
68
  end
69
69
 
70
- def self.insert_all _attributes, _returning: nil, _unique_by: nil
71
- raise NotImplementedError, "Cloud Spanner does not support skip_duplicates."
70
+ def self.insert_all _attributes, **_kwargs
71
+ raise NotImplementedError, "Cloud Spanner does not support skip_duplicates. Use insert! or upsert instead."
72
72
  end
73
73
 
74
- def self.insert_all! attributes, returning: nil
74
+ def self.insert_all! attributes, **_kwargs
75
75
  return super unless spanner_adapter?
76
76
  return super if active_transaction? && !buffered_mutations?
77
77
 
@@ -90,7 +90,7 @@ module ActiveRecord
90
90
  end
91
91
  end
92
92
 
93
- def self.upsert_all attributes, returning: nil, unique_by: nil
93
+ def self.upsert_all attributes, **_kwargs
94
94
  return super unless spanner_adapter?
95
95
  if active_transaction? && !buffered_mutations?
96
96
  raise NotImplementedError, "Cloud Spanner does not support upsert using DML. " \
@@ -5,5 +5,5 @@
5
5
  # https://opensource.org/licenses/MIT.
6
6
 
7
7
  module ActiveRecordSpannerAdapter
8
- VERSION = "1.5.0".freeze
8
+ VERSION = "1.5.1".freeze
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-spanner-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2023-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-spanner