bulk_dependency_eraser 1.0.0 → 1.0.1

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: 3cafe34b586a54a169d2d728ba0a39d9403c90796db9f40c9050620eaa4ef156
4
- data.tar.gz: a1a7001243a75db7740e2fbcbdfbf43dad5253f83de8c757bb7b2d0ab2f57763
3
+ metadata.gz: 97a8415296925a84d544fa6a4deddcd0d5f2162116ed9c7bb210bcc16c2e74e6
4
+ data.tar.gz: f3dca162d1a357c87a305151f087a007005cff8f70656d0e4e514a0c6b419079
5
5
  SHA512:
6
- metadata.gz: 9fc46dd24138b1be6c2ff436e9afdaa4f4f877c37fe23bec00ffec8ce142ffda71c6cccefd7a5d8354986757f9df02f0c64918419d270471eea866226cce87a6
7
- data.tar.gz: ecfa3aca0fdae9d2de444f8fb8427758420c8ffa7ae8370daff95b5ef975db83ec9fc573e91d83e93f84acfd11e117171a1a276b45841954526cba6c481d2b21
6
+ metadata.gz: 8a8fdc09856d111bbcf8a27057515e637b3e29866d9e5963b1851d0678f71c585331aab6cf63e9d8534cf7ad47e624f71035a5a09ba26dd168b10c0cf030f956
7
+ data.tar.gz: 8b3ce6e5e3391f639f9007a1990e21011a5173bc092f7e0eab234751130a3b6d5594f238609014b7e4ddff49b937af7c3773b0c79cbda1e4e4d191060e7fa5f2
@@ -2,6 +2,7 @@ module BulkDependencyEraser
2
2
  class Base
3
3
  DEFAULT_OPTS = {}.freeze
4
4
 
5
+ # Default Database wrapper, no effect.
5
6
  DEFAULT_DB_WRAPPER = ->(block) { block.call }
6
7
 
7
8
  attr_reader :errors
@@ -15,6 +15,12 @@ module BulkDependencyEraser
15
15
  ignore_klass_names_and_dependencies: [],
16
16
  }.freeze
17
17
 
18
+ DEFAULT_DB_WRAPPER = ->(block) do
19
+ ActiveRecord::Base.connected_to(role: :reading) do
20
+ block.call
21
+ end
22
+ end
23
+
18
24
  DEPENDENCY_NULLIFY = %i[
19
25
  nullify
20
26
  ].freeze
@@ -7,6 +7,12 @@ module BulkDependencyEraser
7
7
  enable_invalid_foreign_key_detection: false
8
8
  }.freeze
9
9
 
10
+ DEFAULT_DB_WRAPPER = ->(block) do
11
+ ActiveRecord::Base.connected_to(role: :writing) do
12
+ block.call
13
+ end
14
+ end
15
+
10
16
  def initialize class_names_and_ids: {}, opts: {}
11
17
  @class_names_and_ids = class_names_and_ids
12
18
  super(opts:)
@@ -5,6 +5,12 @@ module BulkDependencyEraser
5
5
  db_nullify_wrapper: self::DEFAULT_DB_WRAPPER
6
6
  }.freeze
7
7
 
8
+ DEFAULT_DB_WRAPPER = ->(block) do
9
+ ActiveRecord::Base.connected_to(role: :writing) do
10
+ block.call
11
+ end
12
+ end
13
+
8
14
  # @param class_names_columns_and_ids [Hash] - model names with columns to nullify pointing towards the record IDs that require the nullification.
9
15
  # - structure:
10
16
  # {
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.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - benjamin.dana.software.dev@gmail.com