pgsync 0.7.2 → 0.7.4

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
  SHA256:
3
- metadata.gz: 2005fe5d8c3aa978ebb5f85d2076e81ee1022564382a6401437c5c683a4968a2
4
- data.tar.gz: 333ac51419e6e6ee8091a14ee78e4e8d1aa7559bdbd13384a27352f35641e9e9
3
+ metadata.gz: bc4b2b6dcbfc310f47e5309a6e8b1f97498f57ff2984ed80ff95d9543904a364
4
+ data.tar.gz: 330f54583496a39c3b6dacbbeaecbb478f016dfb6d4ca489291ba948c10b3498
5
5
  SHA512:
6
- metadata.gz: 0a90323a6a4d2829c0e62c2d3d78245e9978a1c051da7c0913ce1f9a91a4f01bd0a6d80d14d2dbc49b63a0943c492e71d0191a458d3a2e16f0480c59078b7ee4
7
- data.tar.gz: 8d9fa803daf091baa26afc26eba40bdc720b5836651c101bd53ce0e24f9fa9179f49577b61426e1a3315a5bb7fd90c815bfab54a40fb90376756c10392cccef4
6
+ metadata.gz: 7c7fd83f3b69b6ed6289d71df0fdae65e5a24814eead69256a83fae5671079d19259839312e2fbd974654d8b374c23c9709efc59566af23208d6006526cef6cc
7
+ data.tar.gz: 32015c26cc99e4c025a9ee824eaad65ba289164206348d4f5f3fa76bab3e2bcba8bedf695e135439125652c0d6a27bb8aacd14eab75ac970d24a3219554eb910
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.7.4 (2023-03-06)
2
+
3
+ - Fixed issue with slop 4.10.0
4
+
5
+ ## 0.7.3 (2022-11-09)
6
+
7
+ - Fixed issue with pg 1.4.4
8
+ - Fixed output when `pg_restore` not found
9
+
1
10
  ## 0.7.2 (2022-09-19)
2
11
 
3
12
  - Improved error message when a primary key is required
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2022 Andrew Kane
3
+ Copyright (c) 2015-2023 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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. You can also install it with [Homebrew](#homebrew) or [Docker](#docker). If installation fails, you may need to install [dependencies](#dependencies).
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
- Or just the schema
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
- ## Additional Installation Methods
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 --rm ankane/pgsync"
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:
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PgSync
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.4"
3
3
  end
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.2
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: 2022-09-19 00:00:00.000000000 Z
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.8.2
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.8.2
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.3.7
113
+ rubygems_version: 3.4.6
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Sync Postgres data between databases