table_saw 3.3.1 → 3.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b921d13f5e9c67f36860b88c93ea4dbe11b0da810d28b7e3f1fa4a1fd5cf4920
4
- data.tar.gz: 662c17619ac75b5d86d5087936dfec3e62ded597633aa1dc720950cc13809196
3
+ metadata.gz: 98ea98462576a302f53c11edf81f504416947b96b7a70ca90a070ba74d443f54
4
+ data.tar.gz: 1156e3cdec5364eb9c4dcda12407b545e0c28549901721c252682ddc6996d5d5
5
5
  SHA512:
6
- metadata.gz: a186bb9115be47a833ef12b17a69534e50e661fcf4009eb18fbce3a0e128ff4c15599bbf105dcb27f7d53da715d9676a525a9be0f3b3c4874529c2b3edc22c26
7
- data.tar.gz: a1d085d36e9be89b8d3b4ea9320b5ac4371c145487f14f5a69d77a3a1350fd2fd9d7ca9ae7af47b8845475dce56e358762fc5d7410a6d9e664bca0f2514cb616
6
+ metadata.gz: d062afc3ca17ae96451e3769e724692ec590068649a75bbb16b53660b966955bab21c7bb503bb51424b7203395f0c956851038cef13ba384798fddd5564b5ceb
7
+ data.tar.gz: 3fe7d901cef0a8ff3bf730a0e73bd861174ec7a1c72021cd8c477b7791570b6a993391bc753ee26ad7f4a95a9a90ca20a4ca429732e03508da0df75c660ebb25
@@ -13,6 +13,7 @@ jobs:
13
13
  - '3.2'
14
14
  - '3.3'
15
15
  - '3.4'
16
+ - '4.0'
16
17
  activerecord:
17
18
  - '7.2.0'
18
19
  - '8.0.0'
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.7
1
+ ruby 4.0.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_saw (3.3.1)
4
+ table_saw (3.4.0)
5
5
  activerecord (>= 7.1)
6
6
  pg
7
7
  thor
@@ -9,9 +9,9 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (8.1.1)
13
- actionview (= 8.1.1)
14
- activesupport (= 8.1.1)
12
+ actionpack (8.1.2)
13
+ actionview (= 8.1.2)
14
+ activesupport (= 8.1.2)
15
15
  nokogiri (>= 1.8.5)
16
16
  rack (>= 2.2.4)
17
17
  rack-session (>= 1.0.1)
@@ -19,19 +19,19 @@ GEM
19
19
  rails-dom-testing (~> 2.2)
20
20
  rails-html-sanitizer (~> 1.6)
21
21
  useragent (~> 0.16)
22
- actionview (8.1.1)
23
- activesupport (= 8.1.1)
22
+ actionview (8.1.2)
23
+ activesupport (= 8.1.2)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.11)
26
26
  rails-dom-testing (~> 2.2)
27
27
  rails-html-sanitizer (~> 1.6)
28
- activemodel (8.1.1)
29
- activesupport (= 8.1.1)
30
- activerecord (8.1.1)
31
- activemodel (= 8.1.1)
32
- activesupport (= 8.1.1)
28
+ activemodel (8.1.2)
29
+ activesupport (= 8.1.2)
30
+ activerecord (8.1.2)
31
+ activemodel (= 8.1.2)
32
+ activesupport (= 8.1.2)
33
33
  timeout (>= 0.4.0)
34
- activesupport (8.1.1)
34
+ activesupport (8.1.2)
35
35
  base64
36
36
  bigdecimal
37
37
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -50,14 +50,14 @@ GEM
50
50
  thor (>= 0.14.0)
51
51
  ast (2.4.3)
52
52
  base64 (0.3.0)
53
- bigdecimal (3.3.1)
53
+ bigdecimal (4.0.1)
54
54
  builder (3.3.0)
55
55
  coderay (1.1.3)
56
56
  combustion (1.5.0)
57
57
  activesupport (>= 3.0.0)
58
58
  railties (>= 3.0.0)
59
59
  thor (>= 0.14.6)
60
- concurrent-ruby (1.3.5)
60
+ concurrent-ruby (1.3.6)
61
61
  connection_pool (3.0.2)
62
62
  crass (1.0.6)
63
63
  database_cleaner-active_record (2.2.2)
@@ -68,12 +68,12 @@ GEM
68
68
  diff-lcs (1.6.2)
69
69
  docile (1.4.1)
70
70
  drb (2.2.3)
71
- erb (6.0.0)
71
+ erb (6.0.1)
72
72
  erubi (1.13.1)
73
- i18n (1.14.7)
73
+ i18n (1.14.8)
74
74
  concurrent-ruby (~> 1.0)
75
- io-console (0.8.1)
76
- irb (1.15.3)
75
+ io-console (0.8.2)
76
+ irb (1.16.0)
77
77
  pp (>= 0.6.0)
78
78
  rdoc (>= 4.0.0)
79
79
  reline (>= 0.4.2)
@@ -81,29 +81,31 @@ GEM
81
81
  language_server-protocol (3.17.0.5)
82
82
  lint_roller (1.1.0)
83
83
  logger (1.7.0)
84
- loofah (2.24.1)
84
+ loofah (2.25.0)
85
85
  crass (~> 1.0.2)
86
86
  nokogiri (>= 1.12.0)
87
87
  method_source (1.1.0)
88
88
  mini_portile2 (2.8.9)
89
- minitest (5.27.0)
90
- nokogiri (1.18.10)
89
+ minitest (6.0.1)
90
+ prism (~> 1.5)
91
+ nokogiri (1.19.0)
91
92
  mini_portile2 (~> 2.8.2)
92
93
  racc (~> 1.4)
93
94
  ostruct (0.6.3)
94
95
  parallel (1.27.0)
95
- parser (3.3.10.0)
96
+ parser (3.3.10.1)
96
97
  ast (~> 2.4.1)
97
98
  racc
98
- pg (1.6.2)
99
+ pg (1.6.3)
99
100
  pp (0.6.3)
100
101
  prettyprint
101
102
  prettyprint (0.2.0)
102
- prism (1.6.0)
103
- pry (0.15.2)
103
+ prism (1.8.0)
104
+ pry (0.16.0)
104
105
  coderay (~> 1.1)
105
106
  method_source (~> 1.0)
106
- psych (5.3.0)
107
+ reline (>= 0.6.0)
108
+ psych (5.3.1)
107
109
  date
108
110
  stringio
109
111
  racc (1.8.1)
@@ -122,9 +124,9 @@ GEM
122
124
  rails-html-sanitizer (1.6.2)
123
125
  loofah (~> 2.21)
124
126
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
125
- railties (8.1.1)
126
- actionpack (= 8.1.1)
127
- activesupport (= 8.1.1)
127
+ railties (8.1.2)
128
+ actionpack (= 8.1.2)
129
+ activesupport (= 8.1.2)
128
130
  irb (~> 1.13)
129
131
  rackup (>= 1.0.0)
130
132
  rake (>= 12.2)
@@ -133,7 +135,7 @@ GEM
133
135
  zeitwerk (~> 2.6)
134
136
  rainbow (3.1.1)
135
137
  rake (13.0.3)
136
- rdoc (6.17.0)
138
+ rdoc (7.1.0)
137
139
  erb
138
140
  psych (>= 4.0.0)
139
141
  tsort
@@ -153,7 +155,7 @@ GEM
153
155
  diff-lcs (>= 1.2.0, < 2.0)
154
156
  rspec-support (~> 3.13.0)
155
157
  rspec-support (3.13.6)
156
- rubocop (1.81.7)
158
+ rubocop (1.82.1)
157
159
  json (~> 2.3)
158
160
  language_server-protocol (~> 3.17.0.2)
159
161
  lint_roller (~> 1.1.0)
@@ -161,13 +163,13 @@ GEM
161
163
  parser (>= 3.3.0.2)
162
164
  rainbow (>= 2.2.2, < 4.0)
163
165
  regexp_parser (>= 2.9.3, < 3.0)
164
- rubocop-ast (>= 1.47.1, < 2.0)
166
+ rubocop-ast (>= 1.48.0, < 2.0)
165
167
  ruby-progressbar (~> 1.7)
166
168
  unicode-display_width (>= 2.4.0, < 4.0)
167
- rubocop-ast (1.48.0)
169
+ rubocop-ast (1.49.0)
168
170
  parser (>= 3.3.7.2)
169
- prism (~> 1.4)
170
- rubocop-rspec (3.8.0)
171
+ prism (~> 1.7)
172
+ rubocop-rspec (3.9.0)
171
173
  lint_roller (~> 1.1)
172
174
  rubocop (~> 1.81)
173
175
  ruby-progressbar (1.13.0)
@@ -181,15 +183,15 @@ GEM
181
183
  simplecov_json_formatter (~> 0.1)
182
184
  simplecov-html (0.13.2)
183
185
  simplecov_json_formatter (0.1.4)
184
- stringio (3.1.9)
185
- thor (1.4.0)
186
- timeout (0.5.0)
186
+ stringio (3.2.0)
187
+ thor (1.5.0)
188
+ timeout (0.6.0)
187
189
  tsort (0.2.0)
188
190
  tzinfo (2.0.6)
189
191
  concurrent-ruby (~> 1.0)
190
192
  unicode-display_width (3.2.0)
191
193
  unicode-emoji (~> 4.1)
192
- unicode-emoji (4.1.0)
194
+ unicode-emoji (4.2.0)
193
195
  uri (1.1.1)
194
196
  useragent (0.16.11)
195
197
  zeitwerk (2.6.18)
data/exe/table-saw CHANGED
@@ -27,9 +27,11 @@ class CLI < Thor
27
27
  method_option :format, type: :hash, default: { 'type' => 'copy' }
28
28
  method_option :variables, aliases: '-v', type: :hash, default: {},
29
29
  desc: 'This option takes a hash to override variables provided in the manifest'
30
+ method_option :schemas, type: :array, default: ['public'],
31
+ desc: 'Schema(s) to include when querying information_schema (default: public)'
30
32
  def dump
31
33
  TableSaw.configure(options.to_hash)
32
- ::ActiveRecord::Base.establish_connection(TableSaw.configuration.connection)
34
+ TableSaw::ApplicationRecord.establish_connection(TableSaw.configuration.connection)
33
35
  records = TableSaw::DependencyGraph::Build.new(TableSaw::Manifest.instance).call
34
36
  TableSaw::CreateDumpFile.new(records, output: options[:output], format: options[:format]).call
35
37
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (3.3.1)
4
+ table_saw (3.4.0)
5
5
  activerecord (>= 7.1)
6
6
  pg
7
7
  thor
@@ -46,6 +46,8 @@ GEM
46
46
  minitest (>= 5.1)
47
47
  securerandom (>= 0.3)
48
48
  tzinfo (~> 2.0, >= 2.0.5)
49
+ addressable (2.8.9)
50
+ public_suffix (>= 2.0.2, < 8.0)
49
51
  appraisal (2.5.0)
50
52
  bundler
51
53
  rake
@@ -53,7 +55,7 @@ GEM
53
55
  ast (2.4.3)
54
56
  base64 (0.3.0)
55
57
  benchmark (0.5.0)
56
- bigdecimal (3.3.1)
58
+ bigdecimal (4.0.1)
57
59
  builder (3.3.0)
58
60
  cgi (0.5.1)
59
61
  coderay (1.1.3)
@@ -61,7 +63,7 @@ GEM
61
63
  activesupport (>= 3.0.0)
62
64
  railties (>= 3.0.0)
63
65
  thor (>= 0.14.6)
64
- concurrent-ruby (1.3.5)
66
+ concurrent-ruby (1.3.6)
65
67
  connection_pool (3.0.2)
66
68
  crass (1.0.6)
67
69
  database_cleaner-active_record (2.2.2)
@@ -72,46 +74,56 @@ GEM
72
74
  diff-lcs (1.6.2)
73
75
  docile (1.4.1)
74
76
  drb (2.2.3)
75
- erb (6.0.0)
77
+ erb (6.0.2)
76
78
  erubi (1.13.1)
77
- i18n (1.14.7)
79
+ i18n (1.14.8)
78
80
  concurrent-ruby (~> 1.0)
79
- io-console (0.8.1)
80
- irb (1.15.3)
81
+ io-console (0.8.2)
82
+ irb (1.17.0)
81
83
  pp (>= 0.6.0)
84
+ prism (>= 1.3.0)
82
85
  rdoc (>= 4.0.0)
83
86
  reline (>= 0.4.2)
84
- json (2.18.0)
87
+ json (2.19.1)
88
+ json-schema (6.2.0)
89
+ addressable (~> 2.8)
90
+ bigdecimal (>= 3.1, < 5)
85
91
  language_server-protocol (3.17.0.5)
86
92
  lint_roller (1.1.0)
87
93
  logger (1.7.0)
88
- loofah (2.24.1)
94
+ loofah (2.25.1)
89
95
  crass (~> 1.0.2)
90
96
  nokogiri (>= 1.12.0)
97
+ mcp (0.8.0)
98
+ json-schema (>= 4.1)
91
99
  method_source (1.1.0)
92
100
  mini_portile2 (2.8.9)
93
- minitest (5.27.0)
94
- nokogiri (1.18.10)
101
+ minitest (6.0.2)
102
+ drb (~> 2.0)
103
+ prism (~> 1.5)
104
+ nokogiri (1.19.1)
95
105
  mini_portile2 (~> 2.8.2)
96
106
  racc (~> 1.4)
97
107
  ostruct (0.6.3)
98
108
  parallel (1.27.0)
99
- parser (3.3.10.0)
109
+ parser (3.3.10.2)
100
110
  ast (~> 2.4.1)
101
111
  racc
102
- pg (1.6.2)
112
+ pg (1.6.3)
103
113
  pp (0.6.3)
104
114
  prettyprint
105
115
  prettyprint (0.2.0)
106
- prism (1.6.0)
107
- pry (0.15.2)
116
+ prism (1.9.0)
117
+ pry (0.16.0)
108
118
  coderay (~> 1.1)
109
119
  method_source (~> 1.0)
110
- psych (5.3.0)
120
+ reline (>= 0.6.0)
121
+ psych (5.3.1)
111
122
  date
112
123
  stringio
124
+ public_suffix (7.0.5)
113
125
  racc (1.8.1)
114
- rack (3.2.4)
126
+ rack (3.2.5)
115
127
  rack-session (2.1.1)
116
128
  base64 (>= 0.1.0)
117
129
  rack (>= 3.0.0)
@@ -123,8 +135,8 @@ GEM
123
135
  activesupport (>= 5.0.0)
124
136
  minitest
125
137
  nokogiri (>= 1.6)
126
- rails-html-sanitizer (1.6.2)
127
- loofah (~> 2.21)
138
+ rails-html-sanitizer (1.7.0)
139
+ loofah (~> 2.25)
128
140
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
129
141
  railties (7.2.3)
130
142
  actionpack (= 7.2.3)
@@ -138,7 +150,7 @@ GEM
138
150
  zeitwerk (~> 2.6)
139
151
  rainbow (3.1.1)
140
152
  rake (13.0.3)
141
- rdoc (6.17.0)
153
+ rdoc (7.2.0)
142
154
  erb
143
155
  psych (>= 4.0.0)
144
156
  tsort
@@ -154,25 +166,26 @@ GEM
154
166
  rspec-expectations (3.13.5)
155
167
  diff-lcs (>= 1.2.0, < 2.0)
156
168
  rspec-support (~> 3.13.0)
157
- rspec-mocks (3.13.7)
169
+ rspec-mocks (3.13.8)
158
170
  diff-lcs (>= 1.2.0, < 2.0)
159
171
  rspec-support (~> 3.13.0)
160
- rspec-support (3.13.6)
161
- rubocop (1.81.7)
172
+ rspec-support (3.13.7)
173
+ rubocop (1.85.1)
162
174
  json (~> 2.3)
163
175
  language_server-protocol (~> 3.17.0.2)
164
176
  lint_roller (~> 1.1.0)
177
+ mcp (~> 0.6)
165
178
  parallel (~> 1.10)
166
179
  parser (>= 3.3.0.2)
167
180
  rainbow (>= 2.2.2, < 4.0)
168
181
  regexp_parser (>= 2.9.3, < 3.0)
169
- rubocop-ast (>= 1.47.1, < 2.0)
182
+ rubocop-ast (>= 1.49.0, < 2.0)
170
183
  ruby-progressbar (~> 1.7)
171
184
  unicode-display_width (>= 2.4.0, < 4.0)
172
- rubocop-ast (1.48.0)
185
+ rubocop-ast (1.49.1)
173
186
  parser (>= 3.3.7.2)
174
- prism (~> 1.4)
175
- rubocop-rspec (3.8.0)
187
+ prism (~> 1.7)
188
+ rubocop-rspec (3.9.0)
176
189
  lint_roller (~> 1.1)
177
190
  rubocop (~> 1.81)
178
191
  ruby-progressbar (1.13.0)
@@ -186,15 +199,15 @@ GEM
186
199
  simplecov_json_formatter (~> 0.1)
187
200
  simplecov-html (0.13.2)
188
201
  simplecov_json_formatter (0.1.4)
189
- stringio (3.1.9)
190
- thor (1.4.0)
191
- timeout (0.5.0)
202
+ stringio (3.2.0)
203
+ thor (1.5.0)
204
+ timeout (0.6.1)
192
205
  tsort (0.2.0)
193
206
  tzinfo (2.0.6)
194
207
  concurrent-ruby (~> 1.0)
195
208
  unicode-display_width (3.2.0)
196
209
  unicode-emoji (~> 4.1)
197
- unicode-emoji (4.1.0)
210
+ unicode-emoji (4.2.0)
198
211
  useragent (0.16.11)
199
212
  zeitwerk (2.6.18)
200
213
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (3.3.1)
4
+ table_saw (3.4.0)
5
5
  activerecord (>= 7.1)
6
6
  pg
7
7
  thor
@@ -44,6 +44,8 @@ GEM
44
44
  securerandom (>= 0.3)
45
45
  tzinfo (~> 2.0, >= 2.0.5)
46
46
  uri (>= 0.13.1)
47
+ addressable (2.8.9)
48
+ public_suffix (>= 2.0.2, < 8.0)
47
49
  appraisal (2.5.0)
48
50
  bundler
49
51
  rake
@@ -51,14 +53,14 @@ GEM
51
53
  ast (2.4.3)
52
54
  base64 (0.3.0)
53
55
  benchmark (0.5.0)
54
- bigdecimal (3.3.1)
56
+ bigdecimal (4.0.1)
55
57
  builder (3.3.0)
56
58
  coderay (1.1.3)
57
59
  combustion (1.5.0)
58
60
  activesupport (>= 3.0.0)
59
61
  railties (>= 3.0.0)
60
62
  thor (>= 0.14.6)
61
- concurrent-ruby (1.3.5)
63
+ concurrent-ruby (1.3.6)
62
64
  connection_pool (3.0.2)
63
65
  crass (1.0.6)
64
66
  database_cleaner-active_record (2.2.2)
@@ -69,46 +71,56 @@ GEM
69
71
  diff-lcs (1.6.2)
70
72
  docile (1.4.1)
71
73
  drb (2.2.3)
72
- erb (6.0.0)
74
+ erb (6.0.2)
73
75
  erubi (1.13.1)
74
- i18n (1.14.7)
76
+ i18n (1.14.8)
75
77
  concurrent-ruby (~> 1.0)
76
- io-console (0.8.1)
77
- irb (1.15.3)
78
+ io-console (0.8.2)
79
+ irb (1.17.0)
78
80
  pp (>= 0.6.0)
81
+ prism (>= 1.3.0)
79
82
  rdoc (>= 4.0.0)
80
83
  reline (>= 0.4.2)
81
- json (2.18.0)
84
+ json (2.19.1)
85
+ json-schema (6.2.0)
86
+ addressable (~> 2.8)
87
+ bigdecimal (>= 3.1, < 5)
82
88
  language_server-protocol (3.17.0.5)
83
89
  lint_roller (1.1.0)
84
90
  logger (1.7.0)
85
- loofah (2.24.1)
91
+ loofah (2.25.1)
86
92
  crass (~> 1.0.2)
87
93
  nokogiri (>= 1.12.0)
94
+ mcp (0.8.0)
95
+ json-schema (>= 4.1)
88
96
  method_source (1.1.0)
89
97
  mini_portile2 (2.8.9)
90
- minitest (5.27.0)
91
- nokogiri (1.18.10)
98
+ minitest (6.0.2)
99
+ drb (~> 2.0)
100
+ prism (~> 1.5)
101
+ nokogiri (1.19.1)
92
102
  mini_portile2 (~> 2.8.2)
93
103
  racc (~> 1.4)
94
104
  ostruct (0.6.3)
95
105
  parallel (1.27.0)
96
- parser (3.3.10.0)
106
+ parser (3.3.10.2)
97
107
  ast (~> 2.4.1)
98
108
  racc
99
- pg (1.6.2)
109
+ pg (1.6.3)
100
110
  pp (0.6.3)
101
111
  prettyprint
102
112
  prettyprint (0.2.0)
103
- prism (1.6.0)
104
- pry (0.15.2)
113
+ prism (1.9.0)
114
+ pry (0.16.0)
105
115
  coderay (~> 1.1)
106
116
  method_source (~> 1.0)
107
- psych (5.3.0)
117
+ reline (>= 0.6.0)
118
+ psych (5.3.1)
108
119
  date
109
120
  stringio
121
+ public_suffix (7.0.5)
110
122
  racc (1.8.1)
111
- rack (3.2.4)
123
+ rack (3.2.5)
112
124
  rack-session (2.1.1)
113
125
  base64 (>= 0.1.0)
114
126
  rack (>= 3.0.0)
@@ -120,8 +132,8 @@ GEM
120
132
  activesupport (>= 5.0.0)
121
133
  minitest
122
134
  nokogiri (>= 1.6)
123
- rails-html-sanitizer (1.6.2)
124
- loofah (~> 2.21)
135
+ rails-html-sanitizer (1.7.0)
136
+ loofah (~> 2.25)
125
137
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
126
138
  railties (8.0.4)
127
139
  actionpack (= 8.0.4)
@@ -134,7 +146,7 @@ GEM
134
146
  zeitwerk (~> 2.6)
135
147
  rainbow (3.1.1)
136
148
  rake (13.0.3)
137
- rdoc (6.17.0)
149
+ rdoc (7.2.0)
138
150
  erb
139
151
  psych (>= 4.0.0)
140
152
  tsort
@@ -150,25 +162,26 @@ GEM
150
162
  rspec-expectations (3.13.5)
151
163
  diff-lcs (>= 1.2.0, < 2.0)
152
164
  rspec-support (~> 3.13.0)
153
- rspec-mocks (3.13.7)
165
+ rspec-mocks (3.13.8)
154
166
  diff-lcs (>= 1.2.0, < 2.0)
155
167
  rspec-support (~> 3.13.0)
156
- rspec-support (3.13.6)
157
- rubocop (1.81.7)
168
+ rspec-support (3.13.7)
169
+ rubocop (1.85.1)
158
170
  json (~> 2.3)
159
171
  language_server-protocol (~> 3.17.0.2)
160
172
  lint_roller (~> 1.1.0)
173
+ mcp (~> 0.6)
161
174
  parallel (~> 1.10)
162
175
  parser (>= 3.3.0.2)
163
176
  rainbow (>= 2.2.2, < 4.0)
164
177
  regexp_parser (>= 2.9.3, < 3.0)
165
- rubocop-ast (>= 1.47.1, < 2.0)
178
+ rubocop-ast (>= 1.49.0, < 2.0)
166
179
  ruby-progressbar (~> 1.7)
167
180
  unicode-display_width (>= 2.4.0, < 4.0)
168
- rubocop-ast (1.48.0)
181
+ rubocop-ast (1.49.1)
169
182
  parser (>= 3.3.7.2)
170
- prism (~> 1.4)
171
- rubocop-rspec (3.8.0)
183
+ prism (~> 1.7)
184
+ rubocop-rspec (3.9.0)
172
185
  lint_roller (~> 1.1)
173
186
  rubocop (~> 1.81)
174
187
  ruby-progressbar (1.13.0)
@@ -182,15 +195,15 @@ GEM
182
195
  simplecov_json_formatter (~> 0.1)
183
196
  simplecov-html (0.13.2)
184
197
  simplecov_json_formatter (0.1.4)
185
- stringio (3.1.9)
186
- thor (1.4.0)
187
- timeout (0.5.0)
198
+ stringio (3.2.0)
199
+ thor (1.5.0)
200
+ timeout (0.6.1)
188
201
  tsort (0.2.0)
189
202
  tzinfo (2.0.6)
190
203
  concurrent-ruby (~> 1.0)
191
204
  unicode-display_width (3.2.0)
192
205
  unicode-emoji (~> 4.1)
193
- unicode-emoji (4.1.0)
206
+ unicode-emoji (4.2.0)
194
207
  uri (1.1.1)
195
208
  useragent (0.16.11)
196
209
  zeitwerk (2.6.18)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (3.3.1)
4
+ table_saw (3.4.0)
5
5
  activerecord (>= 7.1)
6
6
  pg
7
7
  thor
@@ -9,9 +9,9 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (8.1.1)
13
- actionview (= 8.1.1)
14
- activesupport (= 8.1.1)
12
+ actionpack (8.1.2)
13
+ actionview (= 8.1.2)
14
+ activesupport (= 8.1.2)
15
15
  nokogiri (>= 1.8.5)
16
16
  rack (>= 2.2.4)
17
17
  rack-session (>= 1.0.1)
@@ -19,19 +19,19 @@ GEM
19
19
  rails-dom-testing (~> 2.2)
20
20
  rails-html-sanitizer (~> 1.6)
21
21
  useragent (~> 0.16)
22
- actionview (8.1.1)
23
- activesupport (= 8.1.1)
22
+ actionview (8.1.2)
23
+ activesupport (= 8.1.2)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.11)
26
26
  rails-dom-testing (~> 2.2)
27
27
  rails-html-sanitizer (~> 1.6)
28
- activemodel (8.1.1)
29
- activesupport (= 8.1.1)
30
- activerecord (8.1.1)
31
- activemodel (= 8.1.1)
32
- activesupport (= 8.1.1)
28
+ activemodel (8.1.2)
29
+ activesupport (= 8.1.2)
30
+ activerecord (8.1.2)
31
+ activemodel (= 8.1.2)
32
+ activesupport (= 8.1.2)
33
33
  timeout (>= 0.4.0)
34
- activesupport (8.1.1)
34
+ activesupport (8.1.2)
35
35
  base64
36
36
  bigdecimal
37
37
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -44,20 +44,22 @@ GEM
44
44
  securerandom (>= 0.3)
45
45
  tzinfo (~> 2.0, >= 2.0.5)
46
46
  uri (>= 0.13.1)
47
+ addressable (2.8.9)
48
+ public_suffix (>= 2.0.2, < 8.0)
47
49
  appraisal (2.5.0)
48
50
  bundler
49
51
  rake
50
52
  thor (>= 0.14.0)
51
53
  ast (2.4.3)
52
54
  base64 (0.3.0)
53
- bigdecimal (3.3.1)
55
+ bigdecimal (4.0.1)
54
56
  builder (3.3.0)
55
57
  coderay (1.1.3)
56
58
  combustion (1.5.0)
57
59
  activesupport (>= 3.0.0)
58
60
  railties (>= 3.0.0)
59
61
  thor (>= 0.14.6)
60
- concurrent-ruby (1.3.5)
62
+ concurrent-ruby (1.3.6)
61
63
  connection_pool (3.0.2)
62
64
  crass (1.0.6)
63
65
  database_cleaner-active_record (2.2.2)
@@ -68,64 +70,56 @@ GEM
68
70
  diff-lcs (1.6.2)
69
71
  docile (1.4.1)
70
72
  drb (2.2.3)
71
- erb (6.0.0)
73
+ erb (6.0.2)
72
74
  erubi (1.13.1)
73
- i18n (1.14.7)
75
+ i18n (1.14.8)
74
76
  concurrent-ruby (~> 1.0)
75
- io-console (0.8.1)
76
- irb (1.15.3)
77
+ io-console (0.8.2)
78
+ irb (1.17.0)
77
79
  pp (>= 0.6.0)
80
+ prism (>= 1.3.0)
78
81
  rdoc (>= 4.0.0)
79
82
  reline (>= 0.4.2)
80
- json (2.18.0)
83
+ json (2.19.1)
84
+ json-schema (6.2.0)
85
+ addressable (~> 2.8)
86
+ bigdecimal (>= 3.1, < 5)
81
87
  language_server-protocol (3.17.0.5)
82
88
  lint_roller (1.1.0)
83
89
  logger (1.7.0)
84
- loofah (2.24.1)
90
+ loofah (2.25.1)
85
91
  crass (~> 1.0.2)
86
92
  nokogiri (>= 1.12.0)
93
+ mcp (0.8.0)
94
+ json-schema (>= 4.1)
87
95
  method_source (1.1.0)
88
- minitest (5.27.0)
89
- nokogiri (1.18.10-aarch64-linux-gnu)
90
- racc (~> 1.4)
91
- nokogiri (1.18.10-aarch64-linux-musl)
92
- racc (~> 1.4)
93
- nokogiri (1.18.10-arm-linux-gnu)
94
- racc (~> 1.4)
95
- nokogiri (1.18.10-arm-linux-musl)
96
- racc (~> 1.4)
97
- nokogiri (1.18.10-arm64-darwin)
98
- racc (~> 1.4)
99
- nokogiri (1.18.10-x86_64-darwin)
100
- racc (~> 1.4)
101
- nokogiri (1.18.10-x86_64-linux-gnu)
102
- racc (~> 1.4)
103
- nokogiri (1.18.10-x86_64-linux-musl)
96
+ mini_portile2 (2.8.9)
97
+ minitest (6.0.2)
98
+ drb (~> 2.0)
99
+ prism (~> 1.5)
100
+ nokogiri (1.19.1)
101
+ mini_portile2 (~> 2.8.2)
104
102
  racc (~> 1.4)
105
103
  ostruct (0.6.3)
106
104
  parallel (1.27.0)
107
- parser (3.3.10.0)
105
+ parser (3.3.10.2)
108
106
  ast (~> 2.4.1)
109
107
  racc
110
- pg (1.6.2)
111
- pg (1.6.2-aarch64-linux)
112
- pg (1.6.2-aarch64-linux-musl)
113
- pg (1.6.2-arm64-darwin)
114
- pg (1.6.2-x86_64-darwin)
115
- pg (1.6.2-x86_64-linux)
116
- pg (1.6.2-x86_64-linux-musl)
108
+ pg (1.6.3)
117
109
  pp (0.6.3)
118
110
  prettyprint
119
111
  prettyprint (0.2.0)
120
- prism (1.6.0)
121
- pry (0.15.2)
112
+ prism (1.9.0)
113
+ pry (0.16.0)
122
114
  coderay (~> 1.1)
123
115
  method_source (~> 1.0)
124
- psych (5.3.0)
116
+ reline (>= 0.6.0)
117
+ psych (5.3.1)
125
118
  date
126
119
  stringio
120
+ public_suffix (7.0.5)
127
121
  racc (1.8.1)
128
- rack (3.2.4)
122
+ rack (3.2.5)
129
123
  rack-session (2.1.1)
130
124
  base64 (>= 0.1.0)
131
125
  rack (>= 3.0.0)
@@ -137,12 +131,12 @@ GEM
137
131
  activesupport (>= 5.0.0)
138
132
  minitest
139
133
  nokogiri (>= 1.6)
140
- rails-html-sanitizer (1.6.2)
141
- loofah (~> 2.21)
134
+ rails-html-sanitizer (1.7.0)
135
+ loofah (~> 2.25)
142
136
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
143
- railties (8.1.1)
144
- actionpack (= 8.1.1)
145
- activesupport (= 8.1.1)
137
+ railties (8.1.2)
138
+ actionpack (= 8.1.2)
139
+ activesupport (= 8.1.2)
146
140
  irb (~> 1.13)
147
141
  rackup (>= 1.0.0)
148
142
  rake (>= 12.2)
@@ -151,7 +145,7 @@ GEM
151
145
  zeitwerk (~> 2.6)
152
146
  rainbow (3.1.1)
153
147
  rake (13.0.3)
154
- rdoc (6.17.0)
148
+ rdoc (7.2.0)
155
149
  erb
156
150
  psych (>= 4.0.0)
157
151
  tsort
@@ -167,25 +161,26 @@ GEM
167
161
  rspec-expectations (3.13.5)
168
162
  diff-lcs (>= 1.2.0, < 2.0)
169
163
  rspec-support (~> 3.13.0)
170
- rspec-mocks (3.13.7)
164
+ rspec-mocks (3.13.8)
171
165
  diff-lcs (>= 1.2.0, < 2.0)
172
166
  rspec-support (~> 3.13.0)
173
- rspec-support (3.13.6)
174
- rubocop (1.81.7)
167
+ rspec-support (3.13.7)
168
+ rubocop (1.85.1)
175
169
  json (~> 2.3)
176
170
  language_server-protocol (~> 3.17.0.2)
177
171
  lint_roller (~> 1.1.0)
172
+ mcp (~> 0.6)
178
173
  parallel (~> 1.10)
179
174
  parser (>= 3.3.0.2)
180
175
  rainbow (>= 2.2.2, < 4.0)
181
176
  regexp_parser (>= 2.9.3, < 3.0)
182
- rubocop-ast (>= 1.47.1, < 2.0)
177
+ rubocop-ast (>= 1.49.0, < 2.0)
183
178
  ruby-progressbar (~> 1.7)
184
179
  unicode-display_width (>= 2.4.0, < 4.0)
185
- rubocop-ast (1.48.0)
180
+ rubocop-ast (1.49.1)
186
181
  parser (>= 3.3.7.2)
187
- prism (~> 1.4)
188
- rubocop-rspec (3.8.0)
182
+ prism (~> 1.7)
183
+ rubocop-rspec (3.9.0)
189
184
  lint_roller (~> 1.1)
190
185
  rubocop (~> 1.81)
191
186
  ruby-progressbar (1.13.0)
@@ -199,30 +194,21 @@ GEM
199
194
  simplecov_json_formatter (~> 0.1)
200
195
  simplecov-html (0.13.2)
201
196
  simplecov_json_formatter (0.1.4)
202
- stringio (3.1.9)
203
- thor (1.4.0)
204
- timeout (0.5.0)
197
+ stringio (3.2.0)
198
+ thor (1.5.0)
199
+ timeout (0.6.1)
205
200
  tsort (0.2.0)
206
201
  tzinfo (2.0.6)
207
202
  concurrent-ruby (~> 1.0)
208
203
  unicode-display_width (3.2.0)
209
204
  unicode-emoji (~> 4.1)
210
- unicode-emoji (4.1.0)
205
+ unicode-emoji (4.2.0)
211
206
  uri (1.1.1)
212
207
  useragent (0.16.11)
213
208
  zeitwerk (2.6.18)
214
209
 
215
210
  PLATFORMS
216
- aarch64-linux
217
- aarch64-linux-gnu
218
- aarch64-linux-musl
219
- arm-linux-gnu
220
- arm-linux-musl
221
- arm64-darwin
222
- x86_64-darwin
223
- x86_64-linux
224
- x86_64-linux-gnu
225
- x86_64-linux-musl
211
+ ruby
226
212
 
227
213
  DEPENDENCIES
228
214
  activerecord (~> 8.1.0, < 8.2)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TableSaw
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'uri'
3
4
 
4
5
  module TableSaw
5
6
  class Configuration
6
- attr_writer :variables
7
+ attr_writer :variables, :schemas
7
8
  attr_accessor :dbname, :host, :port, :user, :password, :manifest, :output, :format
8
9
 
9
10
  def connection
@@ -23,5 +24,9 @@ module TableSaw
23
24
  def variables
24
25
  @variables || {}
25
26
  end
27
+
28
+ def schemas
29
+ @schemas || ['public']
30
+ end
26
31
  end
27
32
  end
@@ -51,7 +51,7 @@ module TableSaw
51
51
 
52
52
  Array(formatter.header).each { |line| write_to_file(line) }
53
53
 
54
- TableSaw.connection_pool.with_connection do |conn|
54
+ ApplicationRecord.connection_pool.with_connection do |conn|
55
55
  conn.raw_connection.copy_data "COPY (#{table.copy_statement}) TO STDOUT", formatter.coder do
56
56
  while (row = conn.raw_connection.get_copy_data)
57
57
  write_to_file formatter.dump_row(row)
@@ -37,7 +37,7 @@ module TableSaw
37
37
  def query_result(foreign_key)
38
38
  return [] unless directive.selectable?
39
39
 
40
- TableSaw.connection.exec_query(
40
+ ApplicationRecord.connection.exec_query(
41
41
  format(QUERY, column: foreign_key.column.primary_key, table_name: directive.table_name,
42
42
  clause: TableSaw::Queries::SerializeSqlInClause.new(directive.table_name,
43
43
  directive.primary_key,
@@ -41,7 +41,7 @@ module TableSaw
41
41
  def select_ids(table)
42
42
  return [] unless table.partial?
43
43
 
44
- TableSaw.connection.exec_query(table.query).map { |row| row[TableSaw.schema_cache.primary_keys(table.name)] }
44
+ ApplicationRecord.connection.exec_query(table.query).map { |row| row[TableSaw.schema_cache.primary_keys(table.name)] }
45
45
  end
46
46
  end
47
47
  end
@@ -40,7 +40,7 @@ module TableSaw
40
40
  def query_result(foreign_key)
41
41
  return [] unless directive.selectable?
42
42
 
43
- TableSaw.connection.exec_query(
43
+ ApplicationRecord.connection.exec_query(
44
44
  TableSaw::DependencyGraph::BuildHasManyQuery.new(manifest, directive, foreign_key).call
45
45
  )
46
46
  end
@@ -20,7 +20,7 @@ module TableSaw
20
20
  def quoted_columns
21
21
  TableSaw.schema_cache.columns_hash(table_name)
22
22
  .each_key
23
- .map { |name| TableSaw.connection.quote_column_name(name) }
23
+ .map { |name| ApplicationRecord.connection.quote_column_name(name) }
24
24
  .join(', ')
25
25
  end
26
26
  end
@@ -24,11 +24,11 @@ module TableSaw
24
24
 
25
25
  def quote_value(column, value)
26
26
  type = if ActiveRecord.version >= Gem::Version.create('8.1.0')
27
- column.fetch_cast_type(TableSaw.connection)
27
+ column.fetch_cast_type(ApplicationRecord.connection)
28
28
  else
29
- TableSaw.connection.lookup_cast_type_from_column(column)
29
+ ApplicationRecord.connection.lookup_cast_type_from_column(column)
30
30
  end
31
- TableSaw.connection.quote(type.serialize(type.deserialize(value)))
31
+ ApplicationRecord.connection.quote(type.serialize(type.deserialize(value)))
32
32
  end
33
33
  end
34
34
  end
@@ -16,6 +16,7 @@ module TableSaw
16
16
  join information_schema.key_column_usage kcu on tc.constraint_name = kcu.constraint_name
17
17
  join information_schema.constraint_column_usage ccu on tc.constraint_name = ccu.constraint_name
18
18
  where tc.constraint_type = 'FOREIGN KEY'
19
+ and tc.table_schema IN (:schemas)
19
20
  SQL
20
21
 
21
22
  def constraint_names
@@ -35,7 +36,11 @@ module TableSaw
35
36
  private
36
37
 
37
38
  def result
38
- @result ||= TableSaw.connection.exec_query(QUERY)
39
+ @result ||= ApplicationRecord.connection.exec_query(query)
40
+ end
41
+
42
+ def query
43
+ ApplicationRecord.sanitize_sql_array([QUERY, schemas: TableSaw.configuration.schemas])
39
44
  end
40
45
  end
41
46
  end
@@ -3,10 +3,20 @@
3
3
  module TableSaw
4
4
  module Queries
5
5
  class MaterializedViews
6
- QUERY = 'select matviewname from pg_matviews order by matviewname'
6
+ QUERY = <<~SQL
7
+ select matviewname from pg_matviews
8
+ where schemaname IN (:schemas)
9
+ order by matviewname
10
+ SQL
7
11
 
8
12
  def call
9
- TableSaw.connection.exec_query(QUERY).map { |row| row['matviewname'] }
13
+ ApplicationRecord.connection.exec_query(query).map { |row| row['matviewname'] }
14
+ end
15
+
16
+ private
17
+
18
+ def query
19
+ ApplicationRecord.sanitize_sql_array([QUERY, schemas: TableSaw.configuration.schemas])
10
20
  end
11
21
  end
12
22
  end
@@ -32,7 +32,7 @@ module TableSaw
32
32
 
33
33
  def column_names
34
34
  TableSaw.schema_cache.columns(table_name)
35
- .map { |column| TableSaw.connection.quote_column_name(column.name) }
35
+ .map { |column| ApplicationRecord.connection.quote_column_name(column.name) }
36
36
  .join(', ')
37
37
  end
38
38
 
@@ -6,22 +6,29 @@ module TableSaw
6
6
  QUERY = <<~SQL
7
7
  select
8
8
  pg_get_serial_sequence(kcu.table_name, kcu.column_name) as sequence,
9
- kcu.table_name as table,
10
- kcu.column_name as column
9
+ kcu.table_name as "table",
10
+ kcu.column_name as "column"
11
11
  from information_schema.key_column_usage as kcu
12
12
  inner join information_schema.table_constraints as tc
13
13
  on tc.constraint_name = kcu.constraint_name
14
14
  where tc.constraint_type = 'PRIMARY KEY'
15
+ and kcu.table_schema IN (:schemas)
15
16
  and pg_get_serial_sequence(kcu.table_name, kcu.column_name) is not null
16
17
  SQL
17
18
 
18
19
  SerialSequence = Struct.new(:name, :table, :column)
19
20
 
20
21
  def call
21
- TableSaw.connection.exec_query(QUERY).each_with_object({}) do |row, memo|
22
+ ApplicationRecord.connection.exec_query(query).each_with_object({}) do |row, memo|
22
23
  memo[row['table']] = SerialSequence.new(row['sequence'], row['table'], row['column'])
23
24
  end
24
25
  end
26
+
27
+ private
28
+
29
+ def query
30
+ ApplicationRecord.sanitize_sql_array([QUERY, schemas: TableSaw.configuration.schemas])
31
+ end
25
32
  end
26
33
  end
27
34
  end
@@ -23,7 +23,7 @@ module TableSaw
23
23
 
24
24
  def serialized_values
25
25
  values.map do |value|
26
- TableSaw.connection.quote_default_expression(value, db_column)
26
+ ApplicationRecord.connection.quote_default_expression(value, db_column)
27
27
  end
28
28
  end
29
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSaw
4
- VERSION = '3.3.1'
4
+ VERSION = '3.4.0'
5
5
  end
data/lib/table_saw.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'active_record'
4
4
  require 'active_support/core_ext/string'
5
5
 
6
+ require 'table_saw/application_record'
6
7
  require 'table_saw/configuration'
7
8
  require 'table_saw/dependency_graph'
8
9
  require 'table_saw/information_schema'
@@ -31,20 +32,6 @@ module TableSaw
31
32
  end
32
33
 
33
34
  def self.schema_cache
34
- connection.schema_cache
35
+ ApplicationRecord.connection.schema_cache
35
36
  end
36
-
37
- def self.connection_pool
38
- ActiveRecord::Base.connection_pool
39
- end
40
-
41
- # :nocov:
42
- def self.connection
43
- if ActiveRecord.gem_version < Gem::Version.new('7.2.0')
44
- connection_pool.connection
45
- else
46
- connection_pool.lease_connection
47
- end
48
- end
49
- # :nocov:
50
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_saw
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
@@ -80,6 +80,7 @@ files:
80
80
  - gemfiles/activerecord_8.1.0.gemfile
81
81
  - gemfiles/activerecord_8.1.0.gemfile.lock
82
82
  - lib/table_saw.rb
83
+ - lib/table_saw/application_record.rb
83
84
  - lib/table_saw/associations.rb
84
85
  - lib/table_saw/configuration.rb
85
86
  - lib/table_saw/create_dump_file.rb
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubygems_version: 4.0.0
130
+ rubygems_version: 4.0.3
130
131
  specification_version: 4
131
132
  summary: Create a postgres dump file from a subset of tables
132
133
  test_files: []