rails-pg-extras 4.12.1 → 4.13.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: 6f20af06df3b4d71b414846d2d4f81679ceb4766d488e2fe6664e4ac3bfc6d9e
4
- data.tar.gz: bae4f18704c09fad0eb71c0fc522780e3066548e246b1af55d0245b208cb4fc6
3
+ metadata.gz: b8b00ae8cb079824ce1de1284ccf30cca423e27d361a1e70a05066688f0ee094
4
+ data.tar.gz: e76d91e64b1949a0a92c6255390de16e6e0ce7345835c03d8166db1092173c0f
5
5
  SHA512:
6
- metadata.gz: 8d0f95028c558641e68ad41236444917e0d6758b54e2b655d89dd46b7a0eca93f38337f677bafd486e8f9a81f416a609dc1d20ef84f1803883f353ada1b7b9ca
7
- data.tar.gz: 314bbf8ca0aa006f22a32ae38c53fc1b7adc71d528baee7859abed68624178a147d1a720aa956911e7d7a1c89091cf3323186170a55fec93a2bfa6fd8ddd300c
6
+ metadata.gz: 8288bd8a17c6a44f179595c7b82efc4c4384b55cbfaebd679a73f37dda8e68fcf80a8f02868f93b82c45382be66c0f8fa81a4d83e72765dc18abf67929f1454b
7
+ data.tar.gz: 378693843abc170d78cab4c0da0a2108a7f831f7c48805cb78ec020b1dfc1ded2458d50b04deb884675313a13d1178e7d942c778386109ba9148c2e169869b78
data/README.md CHANGED
@@ -51,6 +51,12 @@ You should see the similar line in the output:
51
51
  RailsPgExtras.add_extensions
52
52
  ```
53
53
 
54
+ By deafult a primary ActiveRecord database connection is used for running metadata queries. To connect to a different database you can specify an `ENV['RAILS_PG_EXTRAS_DATABASE_URL']` value in the following format:
55
+
56
+ ```ruby
57
+ ENV["RAILS_PG_EXTRAS_DATABASE_URL"] = "postgresql://postgres:secret@localhost:5432/database_name"
58
+ ```
59
+
54
60
  ## Usage
55
61
 
56
62
  Each command can be used as a rake task, or a directly from the Ruby code.
@@ -282,7 +288,7 @@ This command provides information on the efficiency of indexes, represented as w
282
288
  ### `locks`
283
289
 
284
290
  ```ruby
285
- RailsPgExtras.locks
291
+ RailsPgExtras.locks(args: { limit: 20 })
286
292
 
287
293
  $ rake pg_extras:locks
288
294
 
@@ -91,7 +91,11 @@ module RailsPgExtras
91
91
  end
92
92
 
93
93
  def self.connection
94
- ActiveRecord::Base.connection
94
+ if (db_url = ENV['RAILS_PG_EXTRAS_DATABASE_URL'])
95
+ ActiveRecord::Base.establish_connection(db_url).connection
96
+ else
97
+ ActiveRecord::Base.connection
98
+ end
95
99
  end
96
100
  end
97
101
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtras
4
- VERSION = "4.12.1"
4
+ VERSION = "4.13.0"
5
5
  end
data/spec/smoke_spec.rb CHANGED
@@ -28,4 +28,14 @@ describe RailsPgExtras do
28
28
  RailsPgExtras.table_info(in_format: :hash)
29
29
  end.not_to raise_error
30
30
  end
31
+
32
+ it "supports custom RAILS_PG_EXTRAS_DATABASE_URL" do
33
+ ENV['RAILS_PG_EXTRAS_DATABASE_URL'] = ENV['DATABASE_URL']
34
+
35
+ expect do
36
+ RailsPgExtras.calls
37
+ end.not_to raise_error
38
+
39
+ ENV['RAILS_PG_EXTRAS_DATABASE_URL'] = nil
40
+ end
31
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.1
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-16 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-pg-extras
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.12.1
19
+ version: 4.13.0
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: 4.12.1
26
+ version: 4.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement