active_record_upsert 0.9.4 → 0.9.5
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 +5 -5
- data/Gemfile.rails-6-0 +5 -0
- data/README.md +6 -4
- data/active_record_upsert.gemspec +1 -2
- data/lib/active_record_upsert.rb +1 -0
- data/lib/active_record_upsert/active_record/persistence.rb +2 -1
- data/lib/active_record_upsert/compatibility/rails60.rb +9 -0
- data/lib/active_record_upsert/version.rb +1 -1
- metadata +7 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 70b72c5ef238f1ffe3f7cfd5e2cc53f3b4c9e31f
|
4
|
+
data.tar.gz: '09bfa1ad9bf6e4ea635371382d1b8e02f5fe8fb0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e75ee846435aeb19b077eb34d844345d86d04374b9bdfb09d5311b3fea00c029dc8acd590b61541186d38efa907166df01faaeffcf9bae022e6116ef3baa405
|
7
|
+
data.tar.gz: 2b2b56642038a8c350bfd6d7cc8a6d5bd1349e353b69b206509ffe68b1e716b95e23e2c71a4c5f2ccdda13b541f1152d69167da1bd6ba07f9fd054daee936430
|
data/Gemfile.rails-6-0
ADDED
data/README.md
CHANGED
@@ -2,9 +2,6 @@
|
|
2
2
|
[](https://travis-ci.org/jesjos/active_record_upsert)
|
3
3
|
[](https://codeclimate.com/github/jesjos/active_record_upsert)
|
4
4
|
|
5
|
-
# NB: INCOMPATIBILITY
|
6
|
-
B/c of a broken build matrix, versions 0.9.2 - 0.9.3 are incompatible with rails < 5.2.1!
|
7
|
-
|
8
5
|
# ActiveRecordUpsert
|
9
6
|
|
10
7
|
Real upsert for PostgreSQL 9.5+ and Rails 5 / ActiveRecord 5. Uses [ON CONFLICT DO UPDATE](http://www.postgresql.org/docs/9.5/static/sql-insert.html).
|
@@ -17,12 +14,17 @@ Real upsert for PostgreSQL 9.5+ and Rails 5 / ActiveRecord 5. Uses [ON CONFLICT
|
|
17
14
|
|
18
15
|
## Prerequisites
|
19
16
|
|
20
|
-
- PostgreSQL 9.5+
|
17
|
+
- PostgreSQL 9.5+ (that's when UPSERT support was added; see Wikipedia's [PostgreSQL Release History](https://en.wikipedia.org/wiki/PostgreSQL#Release_history))
|
21
18
|
- ActiveRecord ~> 5
|
22
19
|
- For MRI: pg
|
23
20
|
|
24
21
|
- For JRuby: No support
|
25
22
|
|
23
|
+
### NB: Releases to avoid
|
24
|
+
|
25
|
+
Due to a broken build matrix, v0.9.2 and v0.9.3 are incompatible with Rails
|
26
|
+
< 5.2.1. [v0.9.4](https://github.com/jesjos/active_record_upsert/releases/tag/v0.9.4) fixed this issue.
|
27
|
+
|
26
28
|
## Installation
|
27
29
|
|
28
30
|
Add this line to your application's Gemfile:
|
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.platform = Gem::Platform::RUBY
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'activerecord', '>= 5.0', '< 6.
|
25
|
-
spec.add_runtime_dependency 'arel', '> 7.0', '< 10.0'
|
24
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.0', '< 6.1'
|
26
25
|
spec.add_runtime_dependency 'pg', '>= 0.18', '< 2.0'
|
27
26
|
end
|
data/lib/active_record_upsert.rb
CHANGED
@@ -13,6 +13,7 @@ require 'active_record_upsert/active_record'
|
|
13
13
|
|
14
14
|
version = defined?(Rails) ? Rails.version : ActiveRecord.version.to_s
|
15
15
|
|
16
|
+
require 'active_record_upsert/compatibility/rails60.rb' if version >= '6.0.0' && version < '6.1.0'
|
16
17
|
require 'active_record_upsert/compatibility/rails51.rb' if version >= '5.1.0' && version < '5.2.0'
|
17
18
|
require 'active_record_upsert/compatibility/rails50.rb' if version >= '5.0.0' && version < '5.1.0'
|
18
19
|
|
@@ -25,7 +25,8 @@ module ActiveRecordUpsert
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def _upsert_record(upsert_attribute_names = changed, arel_condition = nil)
|
28
|
-
|
28
|
+
existing_attribute_names = attributes_for_create(attributes.keys)
|
29
|
+
existing_attributes = attributes_with_values(existing_attribute_names)
|
29
30
|
values = self.class._upsert_record(existing_attributes, upsert_attribute_names, [arel_condition].compact)
|
30
31
|
@attributes = self.class.attributes_builder.build_from_database(values.first.to_h)
|
31
32
|
@new_record = false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_upsert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesper Josefsson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '5.0'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '6.
|
23
|
+
version: '6.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,27 +30,7 @@ dependencies:
|
|
30
30
|
version: '5.0'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '6.
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: arel
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '7.0'
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '10.0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - ">"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '7.0'
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '10.0'
|
33
|
+
version: '6.1'
|
54
34
|
- !ruby/object:Gem::Dependency
|
55
35
|
name: pg
|
56
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +63,7 @@ files:
|
|
83
63
|
- Gemfile.rails-5-0
|
84
64
|
- Gemfile.rails-5-1
|
85
65
|
- Gemfile.rails-5-2
|
66
|
+
- Gemfile.rails-6-0
|
86
67
|
- Gemfile.rails-master
|
87
68
|
- LICENSE
|
88
69
|
- README.md
|
@@ -109,6 +90,7 @@ files:
|
|
109
90
|
- lib/active_record_upsert/arel/visitors/to_sql.rb
|
110
91
|
- lib/active_record_upsert/compatibility/rails50.rb
|
111
92
|
- lib/active_record_upsert/compatibility/rails51.rb
|
93
|
+
- lib/active_record_upsert/compatibility/rails60.rb
|
112
94
|
- lib/active_record_upsert/version.rb
|
113
95
|
homepage: https://github.com/jesjos/active_record_upsert/
|
114
96
|
licenses:
|
@@ -130,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
112
|
version: '0'
|
131
113
|
requirements: []
|
132
114
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.6.14.4
|
134
116
|
signing_key:
|
135
117
|
specification_version: 4
|
136
118
|
summary: Real PostgreSQL 9.5+ upserts using ON CONFLICT for ActiveRecord
|