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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc034a38ab80a2e277860a5a69f6a654e1e461f691f54d6a510814b55279cebd
4
- data.tar.gz: 88055bcbcb73bc260ef4718006f3149d95ea216badb4bd4ac142506e756c1882
3
+ metadata.gz: dc49b9b507510ed728ba6434832c29c44d76fe144ee4b738a7f5ade224caf0d2
4
+ data.tar.gz: 3437d5c44ca6ae2aaaf6d5e283da42d7267e5df2f378ef7abf7a72b63662cc5e
5
5
  SHA512:
6
- metadata.gz: 0c9d1bc7851eaa2f51a853a99b24ff3842940f792938b2eac86ebfcc6471653c0d14de735d837f108ca59118a6661c086566b48475b87f1c98870cd80544dd79
7
- data.tar.gz: 7e09f55e2baf0db2eefd7f2dfc028fda58b7f9ec2469a6bdbcfa56855bd4cf1ddc0b1502468554f56726fcbd08135daecc5e20940d18b2d9a2f49dc2558c5971
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
- attr_reader :deletion_list, :nullification_list
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, { limit: 1 })
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
- # Apply limit if has_one assocation (subset of has_many)
351
- if opts[:limit]
352
- assoc_query = assoc_query.limit(opts[:limit])
353
- end
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
@@ -0,0 +1,3 @@
1
+ module BulkDependencyEraser
2
+ VERSION = "1.1.0".freeze
3
+ end
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
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