rails-pg-extras 4.12.2 → 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: 704a88d0240b75de358954e7c24399b580b112a0d39da66ebab10b1b6c873c68
4
- data.tar.gz: 3323892eb17b871ff0980f782c92f90f7f6c482d4104d155dde4e05c94211704
3
+ metadata.gz: b8b00ae8cb079824ce1de1284ccf30cca423e27d361a1e70a05066688f0ee094
4
+ data.tar.gz: e76d91e64b1949a0a92c6255390de16e6e0ce7345835c03d8166db1092173c0f
5
5
  SHA512:
6
- metadata.gz: 88564f72410fa57d18c7f8a6fd7531d98ae0a3bc46dcd98873bd0fba9821c68df542b875726c0db0c7e3a285019e5627130ac514c1c434361a12cd8a03ca4c9d
7
- data.tar.gz: accc7532505e69f17382391d434cd4b610c5ee6a73a18fc8bcc40734b41c91fc5e10cd39e2c8125d41fd80ad6f4a836eb7596be67c00e56dfe0b3afc44b933d2
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.
@@ -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.2"
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.2
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: 2023-01-03 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.2
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.2
26
+ version: 4.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement