pgsync 0.7.2 → 0.7.3
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 +21 -13
- data/lib/pgsync/data_source.rb +12 -2
- data/lib/pgsync/schema_sync.rb +7 -2
- data/lib/pgsync/version.rb +1 -1
- 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: b57c0423d780695d7379788efa869966318b23e3d8b9d92c8218ffb4cdee8609
|
4
|
+
data.tar.gz: 8e07cdad5a540c72df19ebdcbcc0e1c0e9930b6c4b1eb46f0bf318cada503bdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b91a30483535b049852ef679fe5944f065db7c56825a147775a904290c4a1e6221bfde512d7509cd475d97e5c8586c1107870cea4f19407782cd2f7caba88fc7
|
7
|
+
data.tar.gz: fbd6e09e5231a89824098c193d58f2debd90005df01fa432aff546e72ffc0b7ec6b951a237fb65f09ce640f28f6c660b29c77bc231744378055fe8b53e643b34
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,13 @@ pgsync is a command line tool. To install, run:
|
|
19
19
|
gem install pgsync
|
20
20
|
```
|
21
21
|
|
22
|
-
This will give you the `pgsync` command.
|
22
|
+
This will give you the `pgsync` command. If installation fails, you may need to install [dependencies](#dependencies).
|
23
|
+
|
24
|
+
You can also install it with Homebrew:
|
25
|
+
|
26
|
+
```sh
|
27
|
+
brew install pgsync
|
28
|
+
```
|
23
29
|
|
24
30
|
## Setup
|
25
31
|
|
@@ -347,23 +353,13 @@ Bundler.with_unbundled_env do
|
|
347
353
|
end
|
348
354
|
```
|
349
355
|
|
350
|
-
##
|
351
|
-
|
352
|
-
### Homebrew
|
353
|
-
|
354
|
-
With Homebrew, you can use:
|
355
|
-
|
356
|
-
```sh
|
357
|
-
brew install ankane/brew/pgsync
|
358
|
-
```
|
359
|
-
|
360
|
-
### Docker
|
356
|
+
## Docker
|
361
357
|
|
362
358
|
Get the [Docker image](https://hub.docker.com/r/ankane/pgsync) with:
|
363
359
|
|
364
360
|
```sh
|
365
361
|
docker pull ankane/pgsync
|
366
|
-
alias pgsync="docker run
|
362
|
+
alias pgsync="docker run -ti ankane/pgsync"
|
367
363
|
```
|
368
364
|
|
369
365
|
This will give you the `pgsync` command.
|
@@ -399,6 +395,18 @@ gem install specific_install
|
|
399
395
|
gem specific_install https://github.com/ankane/pgsync.git
|
400
396
|
```
|
401
397
|
|
398
|
+
With Homebrew, run:
|
399
|
+
|
400
|
+
```sh
|
401
|
+
brew upgrade pgsync
|
402
|
+
```
|
403
|
+
|
404
|
+
With Docker, run:
|
405
|
+
|
406
|
+
```sh
|
407
|
+
docker pull ankane/pgsync
|
408
|
+
```
|
409
|
+
|
402
410
|
## Related Projects
|
403
411
|
|
404
412
|
Also check out:
|
data/lib/pgsync/data_source.rb
CHANGED
@@ -19,11 +19,11 @@ module PgSync
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def host
|
22
|
-
@host ||= conninfo[:host]
|
22
|
+
@host ||= dedup_localhost(conninfo[:host])
|
23
23
|
end
|
24
24
|
|
25
25
|
def port
|
26
|
-
@port ||= conninfo[:port]
|
26
|
+
@port ||= dedup_localhost(conninfo[:port])
|
27
27
|
end
|
28
28
|
|
29
29
|
def dbname
|
@@ -189,5 +189,15 @@ module PgSync
|
|
189
189
|
conn.conninfo_hash
|
190
190
|
end
|
191
191
|
end
|
192
|
+
|
193
|
+
# for pg 1.4.4
|
194
|
+
# https://github.com/ged/ruby-pg/issues/490
|
195
|
+
def dedup_localhost(value)
|
196
|
+
if conninfo[:host] == "localhost,localhost" && conninfo[:port].to_s.split(",").uniq.size == 1
|
197
|
+
value.split(",")[0]
|
198
|
+
else
|
199
|
+
value
|
200
|
+
end
|
201
|
+
end
|
192
202
|
end
|
193
203
|
end
|
data/lib/pgsync/schema_sync.rb
CHANGED
@@ -17,6 +17,11 @@ module PgSync
|
|
17
17
|
raise Error, "Cannot use --preserve with --schema-first or --schema-only"
|
18
18
|
end
|
19
19
|
|
20
|
+
# generate commands before starting spinner
|
21
|
+
# for better error output if pg_restore not found
|
22
|
+
dump_command = dump_command()
|
23
|
+
restore_command = restore_command()
|
24
|
+
|
20
25
|
show_spinner = output.tty? && !opts[:debug]
|
21
26
|
|
22
27
|
if show_spinner
|
@@ -29,7 +34,7 @@ module PgSync
|
|
29
34
|
# if spinner, capture lines to show on error
|
30
35
|
lines = []
|
31
36
|
success =
|
32
|
-
run_command do |line|
|
37
|
+
run_command(dump_command, restore_command) do |line|
|
33
38
|
if show_spinner
|
34
39
|
lines << line
|
35
40
|
else
|
@@ -51,7 +56,7 @@ module PgSync
|
|
51
56
|
|
52
57
|
private
|
53
58
|
|
54
|
-
def run_command
|
59
|
+
def run_command(dump_command, restore_command)
|
55
60
|
err_r, err_w = IO.pipe
|
56
61
|
Open3.pipeline_start(dump_command, restore_command, err: err_w) do |wait_thrs|
|
57
62
|
err_w.close
|
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.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|