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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73df0f7ee319edb7461b0fa60f8f8b611b38d798de2c0caf20a9c7d6796a7a85
|
4
|
+
data.tar.gz: 9dedd540069c5bc85d458008c20e48b9b550a75388a1f4d48b1b29b34bb689d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faac93588f6e703f183a773caf553d61b64370439093ac27a7d1a4893f6d887c887fbf1be9082baf78bb81e2c23b24f45a1e4053672e386595ff95c0980a0c4b
|
7
|
+
data.tar.gz: 4d6061c3daf7760d3015a33b52a41354f6bafa21b594a0c2b44852ae928935e1b2e23421ce417de2e65eecdc56de0890d97d0321e07fd3a3c3c104cf56856c88
|
data/CHANGELOG.md
CHANGED
@@ -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,
|
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,
|
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,
|
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. " \
|
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.
|
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
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-spanner
|