bulk_dependency_eraser 3.0.0 → 4.0.0
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 +4 -4
- data/lib/bulk_dependency_eraser/builder.rb +13 -2
- data/lib/bulk_dependency_eraser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e215e610f3c90e10cb386499bea48adc2a12a6cc7ce2a35466de12d5dc2dbb1d
|
4
|
+
data.tar.gz: 3c56acb8837e54c3387a6c2754dcab92e88402084f99198ab62c0ee1ea46d45b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a1b05c9fd919c87a4947409296d65129f82817722d2de883b5f09e873b0851364348face62dc96a2251bb2aa8c8cba678798e0083681c7fa94f3ad0e1b6df6
|
7
|
+
data.tar.gz: 321cda6cc39a9ef3af66023aca8dbd385d46357ead943908d659880f968f2c7e1d5c9c8035d7f8c1c022b21e505aa25fc07be6a93296c73e73c67e0079061ff3
|
@@ -28,6 +28,12 @@ module BulkDependencyEraser
|
|
28
28
|
ignore_tables_and_dependencies: [],
|
29
29
|
ignore_klass_names_and_dependencies: [],
|
30
30
|
disable_batching: false,
|
31
|
+
# Disable model ordering during build batching
|
32
|
+
# - Some tables can be too big to order, and just need to trust the DB order
|
33
|
+
# - Not 100% guaranteed and could leave orphaned records behind.
|
34
|
+
disable_batch_ordering: false,
|
35
|
+
# Same as 'disable_batch_ordering', but only for select classes
|
36
|
+
disable_batch_ordering_for_klasses: [],
|
31
37
|
# a general batching size
|
32
38
|
batch_size: 10_000,
|
33
39
|
# A specific batching size for this class, overrides the batch_size
|
@@ -144,8 +150,8 @@ module BulkDependencyEraser
|
|
144
150
|
if batching_disabled? || !query.where({}).limit_value.nil?
|
145
151
|
# query without batching
|
146
152
|
query_ids = query.pluck(column)
|
147
|
-
|
148
|
-
# query with batching
|
153
|
+
elsif opts_c.disable_batch_ordering || opts_c.disable_batch_ordering_for_klasses.include?(current_klass_name)
|
154
|
+
# query with orderless batching
|
149
155
|
offset = 0
|
150
156
|
loop do
|
151
157
|
new_query_ids = query.offset(offset).limit(batch_size).pluck(column)
|
@@ -156,6 +162,11 @@ module BulkDependencyEraser
|
|
156
162
|
# Move to the next batch
|
157
163
|
offset += batch_size
|
158
164
|
end
|
165
|
+
else
|
166
|
+
# query with ordered batching
|
167
|
+
query.in_batches(of: batch_size) do |subset_query|
|
168
|
+
query_ids += subset_query.pluck(column)
|
169
|
+
end
|
159
170
|
end
|
160
171
|
end
|
161
172
|
|