pgsync 0.7.2 → 0.7.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/CHANGELOG.md +9 -0
- data/LICENSE.txt +1 -1
- data/README.md +31 -15
- data/lib/pgsync/data_source.rb +12 -2
- data/lib/pgsync/schema_sync.rb +7 -2
- data/lib/pgsync/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc4b2b6dcbfc310f47e5309a6e8b1f97498f57ff2984ed80ff95d9543904a364
|
|
4
|
+
data.tar.gz: 330f54583496a39c3b6dacbbeaecbb478f016dfb6d4ca489291ba948c10b3498
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c7fd83f3b69b6ed6289d71df0fdae65e5a24814eead69256a83fae5671079d19259839312e2fbd974654d8b374c23c9709efc59566af23208d6006526cef6cc
|
|
7
|
+
data.tar.gz: 32015c26cc99e4c025a9ee824eaad65ba289164206348d4f5f3fa76bab3e2bcba8bedf695e135439125652c0d6a27bb8aacd14eab75ac970d24a3219554eb910
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
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
|
|
|
@@ -137,7 +143,7 @@ pgsync product:123
|
|
|
137
143
|
|
|
138
144
|
## Schema
|
|
139
145
|
|
|
140
|
-
Sync schema before the data (this wipes out existing data)
|
|
146
|
+
Sync the schema before the data (this wipes out existing data)
|
|
141
147
|
|
|
142
148
|
```sh
|
|
143
149
|
pgsync --schema-first
|
|
@@ -149,7 +155,7 @@ Specify tables
|
|
|
149
155
|
pgsync table1,table2 --schema-first
|
|
150
156
|
```
|
|
151
157
|
|
|
152
|
-
|
|
158
|
+
Sync the schema without data (this wipes out existing data)
|
|
153
159
|
|
|
154
160
|
```sh
|
|
155
161
|
pgsync --schema-only
|
|
@@ -230,6 +236,14 @@ Disable user triggers with:
|
|
|
230
236
|
pgsync --disable-user-triggers
|
|
231
237
|
```
|
|
232
238
|
|
|
239
|
+
## Sequences
|
|
240
|
+
|
|
241
|
+
Skip syncing sequences with:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
pgsync --no-sequences
|
|
245
|
+
```
|
|
246
|
+
|
|
233
247
|
## Append-Only Tables
|
|
234
248
|
|
|
235
249
|
For extremely large, append-only tables, sync in batches.
|
|
@@ -347,23 +361,13 @@ Bundler.with_unbundled_env do
|
|
|
347
361
|
end
|
|
348
362
|
```
|
|
349
363
|
|
|
350
|
-
##
|
|
351
|
-
|
|
352
|
-
### Homebrew
|
|
353
|
-
|
|
354
|
-
With Homebrew, you can use:
|
|
355
|
-
|
|
356
|
-
```sh
|
|
357
|
-
brew install ankane/brew/pgsync
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
### Docker
|
|
364
|
+
## Docker
|
|
361
365
|
|
|
362
366
|
Get the [Docker image](https://hub.docker.com/r/ankane/pgsync) with:
|
|
363
367
|
|
|
364
368
|
```sh
|
|
365
369
|
docker pull ankane/pgsync
|
|
366
|
-
alias pgsync="docker run
|
|
370
|
+
alias pgsync="docker run -ti ankane/pgsync"
|
|
367
371
|
```
|
|
368
372
|
|
|
369
373
|
This will give you the `pgsync` command.
|
|
@@ -399,6 +403,18 @@ gem install specific_install
|
|
|
399
403
|
gem specific_install https://github.com/ankane/pgsync.git
|
|
400
404
|
```
|
|
401
405
|
|
|
406
|
+
With Homebrew, run:
|
|
407
|
+
|
|
408
|
+
```sh
|
|
409
|
+
brew upgrade pgsync
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
With Docker, run:
|
|
413
|
+
|
|
414
|
+
```sh
|
|
415
|
+
docker pull ankane/pgsync
|
|
416
|
+
```
|
|
417
|
+
|
|
402
418
|
## Related Projects
|
|
403
419
|
|
|
404
420
|
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.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parallel
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 4.
|
|
47
|
+
version: 4.10.1
|
|
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
|
-
version: 4.
|
|
54
|
+
version: 4.10.1
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: tty-spinner
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
111
|
version: '0'
|
|
112
112
|
requirements: []
|
|
113
|
-
rubygems_version: 3.
|
|
113
|
+
rubygems_version: 3.4.6
|
|
114
114
|
signing_key:
|
|
115
115
|
specification_version: 4
|
|
116
116
|
summary: Sync Postgres data between databases
|