rails-pg-adapter 0.1.2 → 0.1.4

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: 97c01dddafe1f4d75e9631b6f320698c543ec2699b34a058c1d8410388263a8b
4
- data.tar.gz: 5effd4a3e469459283e690e22793c4a656a2efb091fee970702d56c9a16bdf55
3
+ metadata.gz: 648d36ac2c7b9990f850dc54483824206aba63db49dc17d9379c49ce5ec88e1d
4
+ data.tar.gz: bd0dd4cfd41cc749eb797d95da5d1f8261c586f04da5608068220694cbfdbbc6
5
5
  SHA512:
6
- metadata.gz: 7f95c09b9773b4238bf22ea7d2d780812cd940d85163325073d72fbb44bfa805801733ba412bf6ef0355285512e9aca581898162b239e4fdff7ecc3ae3c9cf63
7
- data.tar.gz: 6c7314c2bb0ec040bc231e782de7c3c2bbb13636eecdc3489c245247b5caba4eaed75d8fcb96d7351b9882b9ee149f66c5f29a5711985e7c03d6b279cab8f064
6
+ metadata.gz: 41c0930afcf109ae0402e36ade421227f3b245358a06ccb79a46bf5da0c5749623b996d401fcf60fe6b00d1ad79a3ed72ffdfc21aaa30f9a5b994536884aef2a
7
+ data.tar.gz: c96c0592c584ce6c3555bf87a880dcea495830f2b3deb1fcf03bc87f036a5b3b46afe00a8395c8b39757b0f7db159975562cd586cbe60c8ec02635103d4e03c4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.1.3] - 2023-04-04
2
+
3
+ - Rescue and recover from `ActiveRecord::ConnectionNotEstablished`
4
+
5
+ ## [0.1.3] - 2023-04-04
6
+
7
+ - Bug fix: Always prepend the patch on boot to avoid issues with loading the monkey patch on some Rails installations
8
+
1
9
  ## [0.1.2] - 2023-03-29
2
10
 
3
11
  - Bug fix: Ensure RailsPgAdapter constant is discoverable
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ group :development do
7
7
  gem "pry"
8
8
  gem "rake"
9
9
  gem "rspec"
10
+ gem "rspec-rails"
10
11
  gem "rubocop"
11
12
  gem "rubocop-rails"
12
13
  gem "rubocop-rspec"
@@ -29,10 +29,6 @@ module RailsPgAdapter
29
29
  RailsPgAdapter.configuration.add_reset_column_information_patch || false
30
30
  end
31
31
 
32
- def self.enabled?
33
- failover_patch? || reset_column_information_patch?
34
- end
35
-
36
32
  def self.reset_configuration
37
33
  @configuration = Configuration.new({
38
34
  add_failover_patch: false,
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require "active_record/connection_adapters/postgresql_adapter"
2
3
 
3
4
  module RailsPgAdapter
4
5
  module Patch
@@ -21,13 +22,13 @@ module RailsPgAdapter
21
22
 
22
23
  def exec_cache(*args)
23
24
  super(*args)
24
- rescue ::ActiveRecord::StatementInvalid => e
25
+ rescue ::ActiveRecord::StatementInvalid, ::ActiveRecord::ConnectionNotEstablished => e
25
26
  handle_error(e) || raise
26
27
  end
27
28
 
28
29
  def exec_no_cache(*args)
29
30
  super(*args)
30
- rescue ::ActiveRecord::StatementInvalid => e
31
+ rescue ::ActiveRecord::StatementInvalid, ::ActiveRecord::ConnectionNotEstablished => e
31
32
  handle_error(e) || raise
32
33
  end
33
34
 
@@ -66,10 +67,10 @@ module RailsPgAdapter
66
67
 
67
68
  def warn(msg)
68
69
  return unless defined?(Rails)
69
- ::Rails.logger.warn("[RailsPgAdapter::Patch] #{msg}")
70
-
70
+ return if Rails.logger.nil?
71
+ ::Rails.logger.warn("[RailsPgAdapter::Patch] #{msg}")
71
72
  end
72
73
  end
73
74
  end
74
75
 
75
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(RailsPgAdapter::Patch) if RailsPgAdapter.enabled?
76
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(RailsPgAdapter::Patch)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgAdapter
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tines Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.0'
19
+ version: '6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '7.0'
26
+ version: '6'
27
27
  description: This project allows you to monkey patch ActiveRecord (PostgreSQL) and
28
28
  auto-heal applications in production when PostgreSQL database fails over or when
29
29
  a cached column (in ActiveRecord schema cache) is removed from the database from