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 +4 -4
- data/README.md +6 -0
- data/lib/rails-pg-extras.rb +5 -1
- data/lib/rails_pg_extras/version.rb +1 -1
- data/spec/smoke_spec.rb +10 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b00ae8cb079824ce1de1284ccf30cca423e27d361a1e70a05066688f0ee094
|
4
|
+
data.tar.gz: e76d91e64b1949a0a92c6255390de16e6e0ce7345835c03d8166db1092173c0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/rails-pg-extras.rb
CHANGED
@@ -91,7 +91,11 @@ module RailsPgExtras
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def self.connection
|
94
|
-
|
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
|
|
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 4.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|