pgsync 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pgsync might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/bin/pgsync +2 -0
- data/lib/pgsync.rb +11 -17
- data/lib/pgsync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5965c8b07a78e8b6a7366c82f62a671c5132680f
|
4
|
+
data.tar.gz: fd0eb3f98cb80da49994b432a16da3b502f1e7e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de08c4e8f0bb3d9375c2b29a13f7e9acfc9d1e123ce132f9563a78dc770b92c0f19a5b25f63c8c2c3862c3efbaa59eeea6f4988e79ff9670040667e90ab181e
|
7
|
+
data.tar.gz: 7a751f528cfc295a71e2dc3123d4c17fe635dfff5b451baa76ec24d6343578afe2921caa28b15f576bd867ce73a1fad8b3c0d294361eeb272edc711c115cff8b
|
data/CHANGELOG.md
CHANGED
data/bin/pgsync
CHANGED
data/lib/pgsync.rb
CHANGED
@@ -150,25 +150,16 @@ module PgSync
|
|
150
150
|
seq_values[seq] = from_connection.exec("select last_value from #{seq}").to_a[0]["last_value"]
|
151
151
|
end
|
152
152
|
|
153
|
-
#
|
154
|
-
|
155
|
-
from_connection.
|
156
|
-
|
157
|
-
|
158
|
-
to_connection.copy_data "COPY #{table} (#{fields}) FROM STDIN" do
|
159
|
-
fconn.copy_data "COPY (SELECT #{copy_fields} FROM #{table}#{where}) TO STDOUT" do
|
160
|
-
while row = fconn.get_copy_data
|
161
|
-
to_connection.put_copy_data(row)
|
162
|
-
end
|
163
|
-
end
|
153
|
+
to_connection.exec("TRUNCATE #{table} CASCADE")
|
154
|
+
to_connection.copy_data "COPY #{table} (#{fields}) FROM STDIN" do
|
155
|
+
from_connection.copy_data "COPY (SELECT #{copy_fields} FROM #{table}#{where}) TO STDOUT" do
|
156
|
+
while row = from_connection.get_copy_data
|
157
|
+
to_connection.put_copy_data(row)
|
164
158
|
end
|
165
|
-
seq_values.each do |seq, value|
|
166
|
-
to_connection.exec("SELECT setval(#{escape(seq)}, #{escape(value)})")
|
167
|
-
end
|
168
|
-
raise PgSync::Rollback
|
169
159
|
end
|
170
|
-
|
171
|
-
|
160
|
+
end
|
161
|
+
seq_values.each do |seq, value|
|
162
|
+
to_connection.exec("SELECT setval(#{escape(seq)}, #{escape(value)})")
|
172
163
|
end
|
173
164
|
end
|
174
165
|
end
|
@@ -228,6 +219,9 @@ module PgSync
|
|
228
219
|
command = source[2..-2]
|
229
220
|
# puts "Running #{command}"
|
230
221
|
source = `#{command}`.chomp
|
222
|
+
unless $?.success?
|
223
|
+
abort "Command exited with non-zero status:\n#{command}"
|
224
|
+
end
|
231
225
|
end
|
232
226
|
source
|
233
227
|
end
|
data/lib/pgsync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|