pg_shrink 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 91758d0f6d6dda346377c31c7e26739d44d209ed
4
- data.tar.gz: 3456597445c2de0dcd3a6d956673ddac607b331d
3
+ metadata.gz: 4d4bd5c0b682c29ae81072befc0f5c962319809a
4
+ data.tar.gz: d9d4aa0ceae5e3c816dfd8cea704a0f5b3f2a404
5
5
  SHA512:
6
- metadata.gz: bf159b0db40e195a2a1caaabf7fd37e8a98eb415ade6ebaaa4258b7e7f1ccc21ed2f8ff3c45fd6388d56fcd2f0528cf68088b80dcfd3a65cac3283773e40fc3d
7
- data.tar.gz: 10a7d63d18ab1a5cf52510b0cd6a4699def302188d53950256e7aa90808da92d80463e5795083ae2f3c5aae0f620f7af80ccb021584f0725091cac02d0e615eb
6
+ metadata.gz: 9183c4d2b6226d8e0c7b610066333de8f7fa1d731663e5f67241722601336f7749d285b42ef3c84b044c0039b0ba671e0a1085ea622af1d9e086999d1ec92db0
7
+ data.tar.gz: 0e55a008ff71f575854f2acc1add7dd7a7f7459385eac3fdf63346d94f469ea0c46e86c50b0b627a01249b8d2595c8c3ff375af1d9579d9e4b26acf8e7995b98
data/bin/pg_shrink CHANGED
@@ -22,11 +22,16 @@ Please make sure you have a Shrinkfile or specify one using -c
22
22
  config_desc = '(Optional) Specify configuration file for how to shrink. ' +
23
23
  ' Will default to Shrinkfile in directory command is being ' +
24
24
  'run from'
25
- 'time pg_shrink is run. It will be modified in place.'
26
25
  opts.on('-c', '--config Shrinkfile', config_desc) do |config|
27
26
  options[:config] = config
28
27
  end
29
28
 
29
+ batch_desc = '(Optional) Specify batch size. Increasing batch size will' +
30
+ 'increase memory requirements but speed execution. Default 10000.'
31
+ opts.on('-b', '--batchsize [10000]', batch_desc)do |batch|
32
+ options[:batch_size] = batch
33
+ end
34
+
30
35
  force_desc = 'Force run without confirmation.'
31
36
  opts.on('--force', force_desc) do
32
37
  options[:force] = true
@@ -1,3 +1,3 @@
1
1
  module PgShrink
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/pg_shrink.rb CHANGED
@@ -18,7 +18,8 @@ module PgShrink
18
18
  {
19
19
  url: nil,
20
20
  config: 'Shrinkfile',
21
- force: false
21
+ force: false,
22
+ batch_size: 10000
22
23
  }
23
24
  end
24
25
 
@@ -53,8 +54,13 @@ module PgShrink
53
54
  end
54
55
 
55
56
  validate_pg_url!(options[:url])
57
+ batch_size = options[:batch_size].to_i
58
+ unless batch_size >= 1
59
+ abort("Batch size must be at least 1. #{options[:batch_size]} is invalid!")
60
+ end
56
61
 
57
- database = Database::Postgres.new(:postgres_url => options[:url])
62
+ database = Database::Postgres.new(:postgres_url => options[:url],
63
+ :batch_size => batch_size)
58
64
 
59
65
  database.instance_eval(File.read(options[:config]), options[:config], 1)
60
66
 
@@ -13,6 +13,13 @@ describe PgShrink do
13
13
  database.connection.disconnect
14
14
  end
15
15
 
16
+
17
+ it "should let you specify a different batch size" do
18
+ opts = PgSpecHelper.pg_config.merge(:batch_size => 20000)
19
+ db = PgShrink::Database::Postgres.new(opts)
20
+ expect(db.batch_size).to eq(20000)
21
+ end
22
+
16
23
  describe "simple foreign_key setup" do
17
24
  before(:all) do
18
25
  # Rspec doesn't want you using 'let' defined things in before(:all)
@@ -63,7 +70,7 @@ describe PgShrink do
63
70
  expect(PgShrink::Database::Postgres).to receive(:new) do |opts|
64
71
  expect(opts[:postgres_url]).to eq(database.connection_string)
65
72
  end.and_return(database)
66
- PgShrink.run(config: shrinkfile, url: url, force: true)
73
+ PgShrink.run(config: shrinkfile, url: url, force: true, batch_size: 5)
67
74
  end
68
75
  end
69
76
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_shrink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ball
@@ -14,182 +14,182 @@ dependencies:
14
14
  name: pg
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sequel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec-nc
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec-mocks
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: guard
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard-rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: pry
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: pry-remote
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: pry-nav
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '>='
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>='
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  description: pg_shrink makes it simple to shrink and sanitize a psql database
@@ -200,8 +200,8 @@ executables:
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
- - .gitignore
204
- - .rspec
203
+ - ".gitignore"
204
+ - ".rspec"
205
205
  - Gemfile
206
206
  - Guardfile
207
207
  - README.md
@@ -237,17 +237,17 @@ require_paths:
237
237
  - lib
238
238
  required_ruby_version: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - '>='
240
+ - - ">="
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - '>='
245
+ - - ">="
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubyforge_project:
250
- rubygems_version: 2.0.3
250
+ rubygems_version: 2.2.2
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: ''