activerecord-pg-extensions 0.2.2 → 0.2.3

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: 39407cedf031029bddd4c9cae80f64da4b635388610a5ed8437cfd7bd1248abd
4
- data.tar.gz: 52f6fe2e76431bb4ae3420256ea2a168123641df2c4a851e61e147196d271be1
3
+ metadata.gz: b19575bd4ea9eed35769514cf347333954d95087f57a65af0fc76f03e509ad96
4
+ data.tar.gz: 7c9e81b01d65797f3a47b344f89089f8d4f7788a5ae6e0ef2301165e370a6111
5
5
  SHA512:
6
- metadata.gz: b67e8b140d12e4cfec7746f764daa05a613aa71bcb378b7f87a19c96ca12c7715e36ec2706e238d511bcc7377fedd4348e4657f11f1c2af47c61e17688c62ea9
7
- data.tar.gz: 248bacb94d750ac4def26b48fb2e6c86637bd874195904153cc346b224e2b919cc3f6577a9b77637ffa788e4caa2a83244760264c27463886f159e64a71e1103
6
+ metadata.gz: f32cdbdf6461d760ae956bd7cd7787fabff8d0b355c2c911e63e33c73357ce7170df4da05b1de5908612830e0bdaf754bba2cb8f9fe518d50d0064ccb5dfa5e9
7
+ data.tar.gz: 548ed3a2d3d90d98a68c5c637f009ae615e21199f764e88ed8ea954952a6ffa46036e022a5a514e5500f8d17ff22fe33080420209e38f9732cde67724a1218ed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.3] - 2021-06-23
4
+
5
+ - Fix extension_available?
6
+
3
7
  ## [0.2.2] - 2021-06-22
4
8
 
5
9
  - Fix bug in Ruby 2.6 calling format wrong.
@@ -79,7 +79,7 @@ module ActiveRecord
79
79
  # check if a particular extension can be installed
80
80
  def extension_available?(extension, version = nil)
81
81
  sql = +"SELECT 1 FROM "
82
- sql << version ? "pg_available_extensions" : "pg_available_extension_versions"
82
+ sql << (version ? "pg_available_extension_versions" : "pg_available_extensions")
83
83
  sql << " WHERE name=#{quote(extension)}"
84
84
  sql << " AND version=#{quote(version)}" if version
85
85
  select_value(sql).to_i == 1
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module PGExtensions
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
@@ -131,6 +131,20 @@ describe ActiveRecord::ConnectionAdapters::PostgreSQLAdapter do
131
131
  it "does not allow dropping no extensions" do
132
132
  expect { connection.drop_extension }.to raise_error(ArgumentError)
133
133
  end
134
+
135
+ describe "#extension_available?" do
136
+ it "works with no version constraint" do
137
+ connection.extension_available?(:postgis)
138
+ expect(connection.executed_statements).to eq ["SELECT 1 FROM pg_available_extensions WHERE name='postgis'"]
139
+ end
140
+
141
+ it "works with a version constraint" do
142
+ connection.extension_available?(:postgis, "2.0")
143
+ expect(connection.executed_statements).to eq(
144
+ ["SELECT 1 FROM pg_available_extension_versions WHERE name='postgis' AND version='2.0'"]
145
+ )
146
+ end
147
+ end
134
148
  end
135
149
  end
136
150
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-pg-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer