storey 2.0.1 → 2.0.2
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/CHANGELOG.md +5 -0
- data/README.md +4 -4
- data/gemfiles/rails_5.0.gemfile.lock +1 -1
- data/gemfiles/rails_5.1.gemfile.lock +1 -1
- data/gemfiles/rails_5.2.gemfile.lock +1 -1
- data/lib/storey.rb +8 -2
- data/lib/storey/duplicator.rb +9 -4
- data/lib/storey/version.rb +1 -1
- data/spec/storey/default_search_path_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89dc451e50d3e25bfa3e2f4028f1718059cd28f8aafab7aaf87a1815837f9121
|
4
|
+
data.tar.gz: 3f32de0842a1c7d05b91fc7b715fbb1710d8452e0fe7db00eb740994d35cb80e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73992092bc15f428a45bea3b4a9de2794f9eeb72f0aaec6d3eee7b36b2cf6c4030ae10d6b9f869702589acc724b3c92dabb4597373541926be2e01fe05b5ba7c
|
7
|
+
data.tar.gz: 0617b1dd0a58fe4bf1d8dacfcd8a1cddd8efcf8ef5ff7f384edbbffd950a905525529f3de1e005a133d647a2806d365be3b5a12c07855f9f81a1c9c234f3e9d3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [2.0.2] - 2018-06-29
|
6
|
+
### Fixed
|
7
|
+
- Fix instances when the default schema is the wrong schema
|
8
|
+
- Silence output when creating schemas
|
9
|
+
|
5
10
|
## [2.0.1] - 2018-06-27
|
6
11
|
### Fixed
|
7
12
|
- Do not blow up `rake db:create` in Rails 5.2
|
data/README.md
CHANGED
@@ -39,16 +39,16 @@ Usage:
|
|
39
39
|
|
40
40
|
## schemas
|
41
41
|
|
42
|
-
Returns all
|
42
|
+
Returns all postgres' schemas.
|
43
43
|
|
44
44
|
Accepts options:
|
45
45
|
|
46
|
-
:
|
46
|
+
:public => true
|
47
47
|
|
48
48
|
Usage:
|
49
49
|
|
50
|
-
Storey.schemas
|
51
|
-
Storey.schemas(:
|
50
|
+
Storey.schemas # defaults to :public => true
|
51
|
+
Storey.schemas(:public => true)
|
52
52
|
|
53
53
|
## default_schema?
|
54
54
|
|
data/lib/storey.rb
CHANGED
@@ -37,7 +37,7 @@ module Storey
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def default_search_path
|
40
|
-
|
40
|
+
set_default_search_path
|
41
41
|
default_search_paths = @@default_search_path.split(',')
|
42
42
|
paths = default_search_paths + self.persistent_schemas
|
43
43
|
paths.uniq!
|
@@ -93,7 +93,7 @@ module Storey
|
|
93
93
|
def create_plain_schema(schema_name)
|
94
94
|
name = suffixify schema_name
|
95
95
|
command = "CREATE SCHEMA #{name}"
|
96
|
-
|
96
|
+
Open3.capture3 psql_load_command(command: command)
|
97
97
|
end
|
98
98
|
|
99
99
|
def schemas(options={})
|
@@ -124,6 +124,8 @@ module Storey
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def switch(name=nil, &block)
|
127
|
+
set_default_search_path
|
128
|
+
|
127
129
|
if block_given?
|
128
130
|
original_schema = schema
|
129
131
|
switch name
|
@@ -243,4 +245,8 @@ module Storey
|
|
243
245
|
BuildsLoadCommand.execute(self.database_config.merge(options))
|
244
246
|
end
|
245
247
|
|
248
|
+
def set_default_search_path
|
249
|
+
@@default_search_path ||= self.schema
|
250
|
+
end
|
251
|
+
|
246
252
|
end
|
data/lib/storey/duplicator.rb
CHANGED
@@ -53,9 +53,14 @@ module Storey
|
|
53
53
|
arg_options['schema-only'] = nil if @structure_only
|
54
54
|
|
55
55
|
switches = Utils.command_line_switches_from(arg_options)
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
pg_dump_command = [
|
57
|
+
"pg_dump",
|
58
|
+
switches,
|
59
|
+
Storey.database_config[:database],
|
60
|
+
].join(" ")
|
61
|
+
|
62
|
+
stdout_str, stderr_str, status = Open3.capture3(pg_dump_command)
|
63
|
+
unless status.exitstatus.zero?
|
59
64
|
raise StoreyError, "There seems to have been a problem dumping `#{@source_schema}` to make a copy of it into `#{@target_schema}`"
|
60
65
|
end
|
61
66
|
end
|
@@ -78,7 +83,7 @@ module Storey
|
|
78
83
|
end
|
79
84
|
|
80
85
|
psql_load_command = BuildsLoadCommand.execute(psql_options)
|
81
|
-
|
86
|
+
Open3.capture3(psql_load_command)
|
82
87
|
|
83
88
|
copy_source_schema_migrations
|
84
89
|
|
data/lib/storey/version.rb
CHANGED
@@ -4,6 +4,14 @@ describe 'Storey', '#default_search_path' do
|
|
4
4
|
|
5
5
|
context "when #default_search_path has not been set before" do
|
6
6
|
it "defaults to the current schema" do
|
7
|
+
Storey.create "anotherschema"
|
8
|
+
|
9
|
+
# A bit of a hack, but set the @@default_search_path so we can test
|
10
|
+
# the scenario when no path has been set
|
11
|
+
Storey.class_variable_set("@@default_search_path", nil)
|
12
|
+
|
13
|
+
Storey.switch "anotherschema"
|
14
|
+
|
7
15
|
expect(Storey.default_search_path).to eq '"$user",public'
|
8
16
|
end
|
9
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|