composite_primary_keys 10.0.4 → 10.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.rdoc +7 -0
- data/lib/composite_primary_keys/relation/batches.rb +24 -5
- data/lib/composite_primary_keys/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f506d34f44d88354550c10d7b79f38c206dfa739c9c903e59c888252db3ae9ed
|
4
|
+
data.tar.gz: 06e5788af10e07e0dbe785338aa35c8cce99df310a7e43d3605b1cefb0eaa0ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ec3b8f8f42e7a5c92f11c60cb86fdb8fd4bdc9e6a58f1f3305ffb5c9b6af9b2abaabcaa43eeaa2e40e19cddab4cad5d7e5501905643e7b4fad0749525ac0b7
|
7
|
+
data.tar.gz: d1a8bad2cdea8ff1eab3ba7d5c456d68f008583b26b6000a930f58d319842aa6b2a24e66d7d509bd531cce4852f062797b96e53c0f929ed8aa0c6a19d40621c2
|
data/History.rdoc
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
== 10.0.5 (2018-06-24)
|
2
|
+
* Fix in_batches (Urmo Rae)
|
3
|
+
|
1
4
|
== 10.0.4 (2018-06-17)
|
2
5
|
|
3
6
|
* Lock mysql2 gem to 0.4.x (Le Trung Kien)
|
@@ -25,6 +28,10 @@
|
|
25
28
|
* Fix typo in Readme (Mike Gunderloy)
|
26
29
|
* Improved sql server support (Artyom Nikolaev)
|
27
30
|
|
31
|
+
== 9.0.10 (2018-06-24)
|
32
|
+
|
33
|
+
* Fix AR 5.0.7 (Jordan Owens)
|
34
|
+
|
28
35
|
== 9.0.8 (2017-10-11)
|
29
36
|
|
30
37
|
* Fix Paper Trail compatibility (Sean Linsley)
|
@@ -7,11 +7,17 @@ module CompositePrimaryKeys
|
|
7
7
|
return BatchEnumerator.new(of: of, start: start, finish: finish, relation: self)
|
8
8
|
end
|
9
9
|
|
10
|
-
if arel.orders.present?
|
11
|
-
|
10
|
+
if arel.orders.present?
|
11
|
+
act_on_ignored_order(error_on_ignore)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
batch_limit = of
|
15
|
+
if limit_value
|
16
|
+
remaining = limit_value
|
17
|
+
batch_limit = remaining if remaining < batch_limit
|
18
|
+
end
|
19
|
+
|
20
|
+
relation = relation.reorder(batch_order).limit(batch_limit)
|
15
21
|
relation = apply_limits(relation, start, finish)
|
16
22
|
batch_relation = relation
|
17
23
|
|
@@ -39,9 +45,22 @@ module CompositePrimaryKeys
|
|
39
45
|
|
40
46
|
yield yielded_relation
|
41
47
|
|
42
|
-
break if ids.length <
|
48
|
+
break if ids.length < batch_limit
|
49
|
+
|
50
|
+
if limit_value
|
51
|
+
remaining -= ids.length
|
52
|
+
|
53
|
+
if remaining == 0
|
54
|
+
# Saves a useless iteration when the limit is a multiple of the
|
55
|
+
# batch size.
|
56
|
+
break
|
57
|
+
elsif remaining < batch_limit
|
58
|
+
relation = relation.limit(remaining)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
43
62
|
# CPK
|
44
|
-
|
63
|
+
batch_relation = relation.where(arel_attribute(primary_key).gt(primary_key_offset))
|
45
64
|
batch_relation = if composite?
|
46
65
|
# CPK
|
47
66
|
# Lexicographically select records
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: composite_primary_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.
|
4
|
+
version: 10.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Savage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|