pgsync 0.7.3 → 0.8.0

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: b57c0423d780695d7379788efa869966318b23e3d8b9d92c8218ffb4cdee8609
4
- data.tar.gz: 8e07cdad5a540c72df19ebdcbcc0e1c0e9930b6c4b1eb46f0bf318cada503bdc
3
+ metadata.gz: 7a7083c722bb2060be572cc9e63911678b17063826fee239de9569f6eb9eb6e3
4
+ data.tar.gz: 1953d0434c070d3123e15d2e25fa5a5a74981a298da08ae39d7bc57c7f2ea00b
5
5
  SHA512:
6
- metadata.gz: b91a30483535b049852ef679fe5944f065db7c56825a147775a904290c4a1e6221bfde512d7509cd475d97e5c8586c1107870cea4f19407782cd2f7caba88fc7
7
- data.tar.gz: fbd6e09e5231a89824098c193d58f2debd90005df01fa432aff546e72ffc0b7ec6b951a237fb65f09ce640f28f6c660b29c77bc231744378055fe8b53e643b34
6
+ metadata.gz: 363586792548ac9e856382c241292e6645b32421acad8dd18e240c095b89ea9fc5bd8a925cc57b2d9cbecca436b6899aa1396aac27cc71876bbf27028e074b06
7
+ data.tar.gz: 6ac5b582f9891428059106d0d40b3e7ddf3bac8442bd92aebb0cd2eff0bda99984ffcb16bd2df5ba6aacdacb58c89bbd0cd7f0d77d1bc59d2dc562c3a9630531
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.8.0 (2024-07-10)
2
+
3
+ - Added Docker image for `linux/arm64`
4
+ - Fixed warning with Ruby 3.3
5
+ - Dropped support for Ruby < 2.7
6
+
7
+ ## 0.7.4 (2023-03-06)
8
+
9
+ - Fixed issue with slop 4.10.0
10
+
1
11
  ## 0.7.3 (2022-11-09)
2
12
 
3
13
  - Fixed issue with pg 1.4.4
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
@@ -9,7 +9,7 @@ Sync data from one Postgres database to another (like `pg_dump`/`pg_restore`). D
9
9
 
10
10
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
11
11
 
12
- [![Build Status](https://github.com/ankane/pgsync/workflows/build/badge.svg?branch=master)](https://github.com/ankane/pgsync/actions)
12
+ [![Build Status](https://github.com/ankane/pgsync/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/pgsync/actions)
13
13
 
14
14
  ## Installation
15
15
 
@@ -143,7 +143,7 @@ pgsync product:123
143
143
 
144
144
  ## Schema
145
145
 
146
- Sync schema before the data (this wipes out existing data)
146
+ Sync the schema before the data (this wipes out existing data)
147
147
 
148
148
  ```sh
149
149
  pgsync --schema-first
@@ -155,7 +155,7 @@ Specify tables
155
155
  pgsync table1,table2 --schema-first
156
156
  ```
157
157
 
158
- Or just the schema
158
+ Sync the schema without data (this wipes out existing data)
159
159
 
160
160
  ```sh
161
161
  pgsync --schema-only
@@ -236,6 +236,14 @@ Disable user triggers with:
236
236
  pgsync --disable-user-triggers
237
237
  ```
238
238
 
239
+ ## Sequences
240
+
241
+ Skip syncing sequences with:
242
+
243
+ ```sh
244
+ pgsync --no-sequences
245
+ ```
246
+
239
247
  ## Append-Only Tables
240
248
 
241
249
  For extremely large, append-only tables, sync in batches.
@@ -244,6 +252,8 @@ For extremely large, append-only tables, sync in batches.
244
252
  pgsync large_table --in-batches
245
253
  ```
246
254
 
255
+ Note: This requires the table to have a numeric, increasing primary key
256
+
247
257
  The script will resume where it left off when run again, making it great for backfills.
248
258
 
249
259
  ## Connection Security
@@ -104,7 +104,7 @@ module PgSync
104
104
  @conn ||= begin
105
105
  begin
106
106
  ENV["PGCONNECT_TIMEOUT"] ||= "3"
107
- if @url =~ /\Apostgres(ql)?:\/\//
107
+ if @url.start_with?("postgres://", "postgresql://")
108
108
  config = @url
109
109
  else
110
110
  config = {dbname: @url}
data/lib/pgsync/task.rb CHANGED
@@ -229,7 +229,7 @@ module PgSync
229
229
 
230
230
  # TODO better performance
231
231
  def rule_match?(table, column, rule)
232
- regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*','[^\.]*') + '\z')
232
+ regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*', '[^\.]*') + '\z')
233
233
  regex.match(column) || regex.match("#{table.name}.#{column}") || regex.match("#{table.schema}.#{table.name}.#{column}")
234
234
  end
235
235
 
@@ -72,7 +72,7 @@ module PgSync
72
72
 
73
73
  tables =
74
74
  if value.include?("*")
75
- regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*','[^\.]*') + '\z')
75
+ regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*', '[^\.]*') + '\z')
76
76
  shared_tables.select { |t| regex.match(t.full_name) || regex.match(t.name) }
77
77
  else
78
78
  [to_table(value)]
@@ -145,7 +145,7 @@ module PgSync
145
145
 
146
146
  to_arr(opts[:exclude]).each do |value|
147
147
  if value.include?("*")
148
- regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*','[^\.]*') + '\z')
148
+ regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*', '[^\.]*') + '\z')
149
149
  tables.reject! { |t| regex.match(t.full_name) || regex.match(t.name) }
150
150
  else
151
151
  tables -= [fully_resolve(to_table(value), error: false)].compact
@@ -1,3 +1,3 @@
1
1
  module PgSync
2
- VERSION = "0.7.3"
2
+ VERSION = "0.8.0"
3
3
  end
data/lib/pgsync.rb CHANGED
@@ -13,18 +13,18 @@ require "uri"
13
13
  require "yaml"
14
14
 
15
15
  # modules
16
- require "pgsync/utils"
17
- require "pgsync/client"
18
- require "pgsync/data_source"
19
- require "pgsync/init"
20
- require "pgsync/schema_sync"
21
- require "pgsync/sequence"
22
- require "pgsync/sync"
23
- require "pgsync/table"
24
- require "pgsync/table_sync"
25
- require "pgsync/task"
26
- require "pgsync/task_resolver"
27
- require "pgsync/version"
16
+ require_relative "pgsync/utils"
17
+ require_relative "pgsync/client"
18
+ require_relative "pgsync/data_source"
19
+ require_relative "pgsync/init"
20
+ require_relative "pgsync/schema_sync"
21
+ require_relative "pgsync/sequence"
22
+ require_relative "pgsync/sync"
23
+ require_relative "pgsync/table"
24
+ require_relative "pgsync/table_sync"
25
+ require_relative "pgsync/task"
26
+ require_relative "pgsync/task_resolver"
27
+ require_relative "pgsync/version"
28
28
 
29
29
  module PgSync
30
30
  class Error < StandardError; end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
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-10 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bigdecimal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: parallel
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: 4.8.2
61
+ version: 4.10.1
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 4.8.2
68
+ version: 4.10.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: tty-spinner
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -103,14 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
117
  requirements:
104
118
  - - ">="
105
119
  - !ruby/object:Gem::Version
106
- version: '2.5'
120
+ version: '2.7'
107
121
  required_rubygems_version: !ruby/object:Gem::Requirement
108
122
  requirements:
109
123
  - - ">="
110
124
  - !ruby/object:Gem::Version
111
125
  version: '0'
112
126
  requirements: []
113
- rubygems_version: 3.3.7
127
+ rubygems_version: 3.5.11
114
128
  signing_key:
115
129
  specification_version: 4
116
130
  summary: Sync Postgres data between databases