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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b19575bd4ea9eed35769514cf347333954d95087f57a65af0fc76f03e509ad96
|
4
|
+
data.tar.gz: 7c9e81b01d65797f3a47b344f89089f8d4f7788a5ae6e0ef2301165e370a6111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f32cdbdf6461d760ae956bd7cd7787fabff8d0b355c2c911e63e33c73357ce7170df4da05b1de5908612830e0bdaf754bba2cb8f9fe518d50d0064ccb5dfa5e9
|
7
|
+
data.tar.gz: 548ed3a2d3d90d98a68c5c637f009ae615e21199f764e88ed8ea954952a6ffa46036e022a5a514e5500f8d17ff22fe33080420209e38f9732cde67724a1218ed
|
data/CHANGELOG.md
CHANGED
@@ -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 ? "
|
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
|
@@ -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
|
|