active_record_postgresql_xverify 0.1.0 → 0.1.1
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/README.md +4 -0
- data/lib/active_record_postgresql_xverify/config.rb +1 -8
- data/lib/active_record_postgresql_xverify/utils.rb +7 -0
- data/lib/active_record_postgresql_xverify/verifiers/aurora_master.rb +2 -9
- data/lib/active_record_postgresql_xverify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bad45d0d51c781a8e2a9ef830c134a78a9f4a937e4d9c73eb8701f8cc426718d
|
4
|
+
data.tar.gz: c6f32b0817816dc1d80c81b21cbabb6443f1d96157d49857abcd07db473b9623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19f231494a3ed791e7594b0ef2f8af8bce8c2cab6dd27e856320f8d5d1193d89c9923fec887f15593da288122f940b236b7ab93d38a1fccc14349f6965cd05e0
|
7
|
+
data.tar.gz: afd1290d4abd66988a8b8b66b2671c5d5d179f7447dd5e2cc9a49d155b49cd418b5b872fed4c24e27efd1b547aefe90bf7a7422b8735767b22db3010614dafd7
|
data/README.md
CHANGED
@@ -4,14 +4,7 @@ module ActiveRecordPostgresqlXverify
|
|
4
4
|
@config = {
|
5
5
|
handle_if: ->(_) { true },
|
6
6
|
only_on_error: true,
|
7
|
-
verify:
|
8
|
-
begin
|
9
|
-
conn.query 'SELECT 1'
|
10
|
-
true
|
11
|
-
rescue PG::Error
|
12
|
-
false
|
13
|
-
end
|
14
|
-
end,
|
7
|
+
verify: ->(conn) { ActiveRecordPostgresqlXverify::Utils.pg_ping(conn) },
|
15
8
|
}
|
16
9
|
|
17
10
|
class << self
|
@@ -7,6 +7,13 @@ module ActiveRecordPostgresqlXverify
|
|
7
7
|
cih = conn.conninfo_hash
|
8
8
|
"host=#{cih[:host]}, database=#{cih[:dbname]}, username=#{cih[:user]}"
|
9
9
|
end
|
10
|
+
|
11
|
+
def pg_ping(conn)
|
12
|
+
conn.query 'SELECT 1'
|
13
|
+
true
|
14
|
+
rescue PG::Error
|
15
|
+
false
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -3,15 +3,8 @@
|
|
3
3
|
module ActiveRecordPostgresqlXverify
|
4
4
|
module Verifiers
|
5
5
|
AURORA_MASTER = lambda do |conn|
|
6
|
-
|
7
|
-
|
8
|
-
true
|
9
|
-
rescue PG::Error
|
10
|
-
false
|
11
|
-
end
|
12
|
-
|
13
|
-
ping && conn.query('show transaction_read_only')
|
14
|
-
.first.fetch('transaction_read_only') == 'off'
|
6
|
+
ActiveRecordPostgresqlXverify::Utils.pg_ping(conn) && conn.query('show transaction_read_only')
|
7
|
+
.first.fetch('transaction_read_only') == 'off'
|
15
8
|
end
|
16
9
|
end
|
17
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_postgresql_xverify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|