sequel-postgres-schemata 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sequel/postgres/schemata.rb +2 -2
- data/lib/sequel/postgres/schemata/version.rb +1 -1
- data/spec/schemata_spec.rb +8 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d37a44aec26c81236ec3faed93d070e979470d24
|
4
|
+
data.tar.gz: 8f45729d8dfb844871fe82fb87fe2b5887675c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97eae6ecccd8c8244812da30778488380b8f8feb947fea5f544e521dc3726af14d53f8f8e74f4026d347cb6d570ea8cf8e4824e27d6ef2f80b8551b68d0653cf
|
7
|
+
data.tar.gz: 2845aa0d56e81c4f164836d51210f1c10cf0661f5a6ed1ac59e33f4fc2af39d0dacef095d1258a89e55e90f14fc394ecd638452ca258b67e256ef1a6e0cefc43
|
@@ -18,7 +18,7 @@ module Sequel
|
|
18
18
|
def search_path
|
19
19
|
metadata_dataset.with_sql(SHOW_SEARCH_PATH).
|
20
20
|
single_value.scan(SCHEMA_SCAN_RE).flatten.
|
21
|
-
map{|s|s.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
|
21
|
+
map{|s|s.strip.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
|
22
22
|
end
|
23
23
|
|
24
24
|
# Sets the search path. Starting with Postgres 9.2 it can contain
|
@@ -54,7 +54,7 @@ module Sequel
|
|
54
54
|
private
|
55
55
|
|
56
56
|
SHOW_SEARCH_PATH = "SHOW search_path".freeze
|
57
|
-
SCHEMA_SCAN_RE = /(?<=\A|,
|
57
|
+
SCHEMA_SCAN_RE = /(?<=\A|,)(".*?"|.*?)(?=,|\z)/.freeze
|
58
58
|
SCHEMA_SUB_RE = /\A"(.*)"\z/.freeze
|
59
59
|
RENAME_SCHEMA_SQL = 'ALTER SCHEMA "%s" RENAME TO "%s"'.freeze
|
60
60
|
end
|
data/spec/schemata_spec.rb
CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Sequel::Postgres::Schemata do
|
4
4
|
|
5
5
|
let(:db) { Sequel::connect adapter: 'postgres', search_path: %w(foo public) }
|
6
|
+
let(:plain_db) { Sequel::connect adapter: 'postgres' }
|
6
7
|
|
7
8
|
describe "#schemata" do
|
8
9
|
it "lists all existing schematas" do
|
@@ -16,6 +17,10 @@ describe Sequel::Postgres::Schemata do
|
|
16
17
|
it "returns the search path" do
|
17
18
|
db.search_path.should == %i(foo public)
|
18
19
|
end
|
20
|
+
|
21
|
+
it "correctly handles the default list" do
|
22
|
+
expect(plain_db.search_path).to eq(%i($user public))
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
describe "#search_path=" do
|
@@ -44,9 +49,9 @@ describe Sequel::Postgres::Schemata do
|
|
44
49
|
db.search_path.should == %i(bar baz)
|
45
50
|
end
|
46
51
|
|
47
|
-
it "quotes the string list" do
|
48
|
-
db.search_path =
|
49
|
-
db.search_path.should ==
|
52
|
+
it "quotes the string list correctly" do
|
53
|
+
db.search_path = ["bar\" ',", "baz"]
|
54
|
+
db.search_path.should == [:"bar\" ',", :baz]
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-postgres-schemata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafał Rzepecki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -125,3 +125,4 @@ summary: Postgres schema manipulation
|
|
125
125
|
test_files:
|
126
126
|
- spec/schemata_spec.rb
|
127
127
|
- spec/spec_helper.rb
|
128
|
+
has_rdoc:
|