bulk_dependency_eraser 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bulk_dependency_eraser/builder.rb +8 -6
- data/lib/bulk_dependency_eraser/version.rb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc49b9b507510ed728ba6434832c29c44d76fe144ee4b738a7f5ade224caf0d2
|
4
|
+
data.tar.gz: 3437d5c44ca6ae2aaaf6d5e283da42d7267e5df2f378ef7abf7a72b63662cc5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f15ccf36462a1fa821843dd5b05144e078be9a624620b297c02b0bb9e4252b997c0db56ae7546962163559a4f141eeaa2c3be571e1edafb5faa41cb1c83c563
|
7
|
+
data.tar.gz: 6a72116ef8842358a7de07f461cae3a3fbb2b6bfce2a0b725dd373534480a84fd69e81c18838178bea8d65788039671244c76df2d1669bc470687354929c130d
|
@@ -48,7 +48,8 @@ module BulkDependencyEraser
|
|
48
48
|
'ActiveRecord::Reflection::HasAndBelongsToManyReflection'
|
49
49
|
].freeze
|
50
50
|
|
51
|
-
|
51
|
+
# write access so that these can be edited in-place by end-users who might need to manually adjust deletion order.
|
52
|
+
attr_accessor :deletion_list, :nullification_list
|
52
53
|
attr_reader :ignore_table_deletion_list, :ignore_table_nullification_list
|
53
54
|
|
54
55
|
def initialize query:, opts: {}
|
@@ -260,7 +261,7 @@ module BulkDependencyEraser
|
|
260
261
|
when 'ActiveRecord::Reflection::HasManyReflection'
|
261
262
|
association_parser_has_many(parent_class, query, query_ids, association_name, type)
|
262
263
|
when 'ActiveRecord::Reflection::HasOneReflection'
|
263
|
-
association_parser_has_many(parent_class, query, query_ids, association_name, type
|
264
|
+
association_parser_has_many(parent_class, query, query_ids, association_name, type)
|
264
265
|
when 'ActiveRecord::Reflection::BelongsToReflection'
|
265
266
|
if type == :nullify
|
266
267
|
report_error("#{parent_class.name}'s association '#{association_name}' - dependent 'nullify' invalid for 'belongs_to'")
|
@@ -347,10 +348,11 @@ module BulkDependencyEraser
|
|
347
348
|
assoc_query = assoc_query.where(specified_foreign_key.to_sym => query_ids)
|
348
349
|
end
|
349
350
|
|
350
|
-
#
|
351
|
-
if
|
352
|
-
|
353
|
-
|
351
|
+
# Works in theory for ONE record's has_one, but we're dealing with potentially many
|
352
|
+
# # Apply limit if has_one assocation (subset of has_many)
|
353
|
+
# if opts[:limit]
|
354
|
+
# assoc_query = assoc_query.limit(opts[:limit])
|
355
|
+
# end
|
354
356
|
|
355
357
|
if type == :delete
|
356
358
|
# Recursively call 'deletion_query_parser' on association query, to delete any if the assoc's dependencies
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_dependency_eraser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benjamin.dana.software.dev@gmail.com
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/bulk_dependency_eraser/deleter.rb
|
149
149
|
- lib/bulk_dependency_eraser/manager.rb
|
150
150
|
- lib/bulk_dependency_eraser/nullifier.rb
|
151
|
+
- lib/bulk_dependency_eraser/version.rb
|
151
152
|
homepage: https://github.com/danabr75/bulk_dependency_eraser
|
152
153
|
licenses:
|
153
154
|
- LGPL-3.0-only
|