table_saw 3.3.0 → 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: 22239851807e1ad5dadfdfabb9f78ae4ff1d5951209ffe626c2989d7368e0fe2
4
- data.tar.gz: 78eb40b85de4b2a3a05c5c43d65f03d66c2fe9d6285de426418bc26250648325
3
+ metadata.gz: 98ea98462576a302f53c11edf81f504416947b96b7a70ca90a070ba74d443f54
4
+ data.tar.gz: 1156e3cdec5364eb9c4dcda12407b545e0c28549901721c252682ddc6996d5d5
5
5
  SHA512:
6
- metadata.gz: 42bba4bf487e401bc56ab03c5ae1f451c85f7067fcaa5df98dc52e437b2805b06903d4fd8f4a6c8f1eb96c3973c5b88b89511c6a46245053425ca6e9680ad01f
7
- data.tar.gz: b767525b7232bd54347b7e27c8e3befac5c0c1c2384bc6d342d3d42aa0569a49ae68d2d3e2678274fd12885881b337dcb555a21f4db3a09f8a3756f76a583760
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.0)
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,70 +50,72 @@ 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)
61
- connection_pool (2.5.4)
60
+ concurrent-ruby (1.3.6)
61
+ connection_pool (3.0.2)
62
62
  crass (1.0.6)
63
63
  database_cleaner-active_record (2.2.2)
64
64
  activerecord (>= 5.a)
65
65
  database_cleaner-core (~> 2.0)
66
66
  database_cleaner-core (2.0.1)
67
- date (3.5.0)
67
+ date (3.5.1)
68
68
  diff-lcs (1.6.2)
69
69
  docile (1.4.1)
70
70
  drb (2.2.3)
71
- erb (5.1.3)
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)
80
- json (2.15.2)
80
+ json (2.18.0)
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.26.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.2.6)
107
+ reline (>= 0.6.0)
108
+ psych (5.3.1)
107
109
  date
108
110
  stringio
109
111
  racc (1.8.1)
110
- rack (3.2.3)
112
+ rack (3.2.4)
111
113
  rack-session (2.1.1)
112
114
  base64 (>= 0.1.0)
113
115
  rack (>= 3.0.0)
114
116
  rack-test (2.2.0)
115
117
  rack (>= 1.3)
116
- rackup (2.2.1)
118
+ rackup (2.3.1)
117
119
  rack (>= 3)
118
120
  rails-dom-testing (2.3.0)
119
121
  activesupport (>= 5.0.0)
@@ -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,12 +135,12 @@ GEM
133
135
  zeitwerk (~> 2.6)
134
136
  rainbow (3.1.1)
135
137
  rake (13.0.3)
136
- rdoc (6.15.1)
138
+ rdoc (7.1.0)
137
139
  erb
138
140
  psych (>= 4.0.0)
139
141
  tsort
140
142
  regexp_parser (2.11.3)
141
- reline (0.6.2)
143
+ reline (0.6.3)
142
144
  io-console (~> 0.5)
143
145
  rspec (3.13.2)
144
146
  rspec-core (~> 3.13.0)
@@ -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,15 +163,15 @@ 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.47.1)
169
+ rubocop-ast (1.49.0)
168
170
  parser (>= 3.3.7.2)
169
- prism (~> 1.4)
170
- rubocop-rspec (3.7.0)
171
+ prism (~> 1.7)
172
+ rubocop-rspec (3.9.0)
171
173
  lint_roller (~> 1.1)
172
- rubocop (~> 1.72, >= 1.72.1)
174
+ rubocop (~> 1.81)
173
175
  ruby-progressbar (1.13.0)
174
176
  scenic (1.9.0)
175
177
  activerecord (>= 4.0.0)
@@ -181,16 +183,16 @@ 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.7)
185
- thor (1.4.0)
186
- timeout (0.4.4)
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)
193
- uri (1.1.0)
194
+ unicode-emoji (4.2.0)
195
+ uri (1.1.1)
194
196
  useragent (0.16.11)
195
197
  zeitwerk (2.6.18)
196
198
 
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.0)
4
+ table_saw (3.4.0)
5
5
  activerecord (>= 7.1)
6
6
  pg
7
7
  thor
@@ -9,30 +9,32 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.2.2.2)
13
- actionview (= 7.2.2.2)
14
- activesupport (= 7.2.2.2)
12
+ actionpack (7.2.3)
13
+ actionview (= 7.2.3)
14
+ activesupport (= 7.2.3)
15
+ cgi
15
16
  nokogiri (>= 1.8.5)
16
17
  racc
17
- rack (>= 2.2.4, < 3.2)
18
+ rack (>= 2.2.4, < 3.3)
18
19
  rack-session (>= 1.0.1)
19
20
  rack-test (>= 0.6.3)
20
21
  rails-dom-testing (~> 2.2)
21
22
  rails-html-sanitizer (~> 1.6)
22
23
  useragent (~> 0.16)
23
- actionview (7.2.2.2)
24
- activesupport (= 7.2.2.2)
24
+ actionview (7.2.3)
25
+ activesupport (= 7.2.3)
25
26
  builder (~> 3.1)
27
+ cgi
26
28
  erubi (~> 1.11)
27
29
  rails-dom-testing (~> 2.2)
28
30
  rails-html-sanitizer (~> 1.6)
29
- activemodel (7.2.2.2)
30
- activesupport (= 7.2.2.2)
31
- activerecord (7.2.2.2)
32
- activemodel (= 7.2.2.2)
33
- activesupport (= 7.2.2.2)
31
+ activemodel (7.2.3)
32
+ activesupport (= 7.2.3)
33
+ activerecord (7.2.3)
34
+ activemodel (= 7.2.3)
35
+ activesupport (= 7.2.3)
34
36
  timeout (>= 0.4.0)
35
- activesupport (7.2.2.2)
37
+ activesupport (7.2.3)
36
38
  base64
37
39
  benchmark (>= 0.3)
38
40
  bigdecimal
@@ -44,132 +46,148 @@ GEM
44
46
  minitest (>= 5.1)
45
47
  securerandom (>= 0.3)
46
48
  tzinfo (~> 2.0, >= 2.0.5)
49
+ addressable (2.8.9)
50
+ public_suffix (>= 2.0.2, < 8.0)
47
51
  appraisal (2.5.0)
48
52
  bundler
49
53
  rake
50
54
  thor (>= 0.14.0)
51
55
  ast (2.4.3)
52
56
  base64 (0.3.0)
53
- benchmark (0.4.1)
54
- bigdecimal (3.3.1)
57
+ benchmark (0.5.0)
58
+ bigdecimal (4.0.1)
55
59
  builder (3.3.0)
60
+ cgi (0.5.1)
56
61
  coderay (1.1.3)
57
62
  combustion (1.5.0)
58
63
  activesupport (>= 3.0.0)
59
64
  railties (>= 3.0.0)
60
65
  thor (>= 0.14.6)
61
- concurrent-ruby (1.3.5)
62
- connection_pool (2.5.4)
66
+ concurrent-ruby (1.3.6)
67
+ connection_pool (3.0.2)
63
68
  crass (1.0.6)
64
69
  database_cleaner-active_record (2.2.2)
65
70
  activerecord (>= 5.a)
66
71
  database_cleaner-core (~> 2.0)
67
72
  database_cleaner-core (2.0.1)
68
- date (3.4.1)
73
+ date (3.5.1)
69
74
  diff-lcs (1.6.2)
70
75
  docile (1.4.1)
71
76
  drb (2.2.3)
72
- erb (5.1.1)
77
+ erb (6.0.2)
73
78
  erubi (1.13.1)
74
- i18n (1.14.7)
79
+ i18n (1.14.8)
75
80
  concurrent-ruby (~> 1.0)
76
- io-console (0.8.1)
77
- irb (1.15.2)
81
+ io-console (0.8.2)
82
+ irb (1.17.0)
78
83
  pp (>= 0.6.0)
84
+ prism (>= 1.3.0)
79
85
  rdoc (>= 4.0.0)
80
86
  reline (>= 0.4.2)
81
- json (2.15.1)
87
+ json (2.19.1)
88
+ json-schema (6.2.0)
89
+ addressable (~> 2.8)
90
+ bigdecimal (>= 3.1, < 5)
82
91
  language_server-protocol (3.17.0.5)
83
92
  lint_roller (1.1.0)
84
93
  logger (1.7.0)
85
- loofah (2.24.1)
94
+ loofah (2.25.1)
86
95
  crass (~> 1.0.2)
87
96
  nokogiri (>= 1.12.0)
97
+ mcp (0.8.0)
98
+ json-schema (>= 4.1)
88
99
  method_source (1.1.0)
89
100
  mini_portile2 (2.8.9)
90
- minitest (5.26.0)
91
- nokogiri (1.18.10)
101
+ minitest (6.0.2)
102
+ drb (~> 2.0)
103
+ prism (~> 1.5)
104
+ nokogiri (1.19.1)
92
105
  mini_portile2 (~> 2.8.2)
93
106
  racc (~> 1.4)
94
107
  ostruct (0.6.3)
95
108
  parallel (1.27.0)
96
- parser (3.3.9.0)
109
+ parser (3.3.10.2)
97
110
  ast (~> 2.4.1)
98
111
  racc
99
- pg (1.6.2)
112
+ pg (1.6.3)
100
113
  pp (0.6.3)
101
114
  prettyprint
102
115
  prettyprint (0.2.0)
103
- prism (1.5.2)
104
- pry (0.15.2)
116
+ prism (1.9.0)
117
+ pry (0.16.0)
105
118
  coderay (~> 1.1)
106
119
  method_source (~> 1.0)
107
- psych (5.2.6)
120
+ reline (>= 0.6.0)
121
+ psych (5.3.1)
108
122
  date
109
123
  stringio
124
+ public_suffix (7.0.5)
110
125
  racc (1.8.1)
111
- rack (3.1.18)
126
+ rack (3.2.5)
112
127
  rack-session (2.1.1)
113
128
  base64 (>= 0.1.0)
114
129
  rack (>= 3.0.0)
115
130
  rack-test (2.2.0)
116
131
  rack (>= 1.3)
117
- rackup (2.2.1)
132
+ rackup (2.3.1)
118
133
  rack (>= 3)
119
134
  rails-dom-testing (2.3.0)
120
135
  activesupport (>= 5.0.0)
121
136
  minitest
122
137
  nokogiri (>= 1.6)
123
- rails-html-sanitizer (1.6.2)
124
- loofah (~> 2.21)
138
+ rails-html-sanitizer (1.7.0)
139
+ loofah (~> 2.25)
125
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)
126
- railties (7.2.2.2)
127
- actionpack (= 7.2.2.2)
128
- activesupport (= 7.2.2.2)
141
+ railties (7.2.3)
142
+ actionpack (= 7.2.3)
143
+ activesupport (= 7.2.3)
144
+ cgi
129
145
  irb (~> 1.13)
130
146
  rackup (>= 1.0.0)
131
147
  rake (>= 12.2)
132
148
  thor (~> 1.0, >= 1.2.2)
149
+ tsort (>= 0.2)
133
150
  zeitwerk (~> 2.6)
134
151
  rainbow (3.1.1)
135
152
  rake (13.0.3)
136
- rdoc (6.15.0)
153
+ rdoc (7.2.0)
137
154
  erb
138
155
  psych (>= 4.0.0)
139
156
  tsort
140
157
  regexp_parser (2.11.3)
141
- reline (0.6.2)
158
+ reline (0.6.3)
142
159
  io-console (~> 0.5)
143
- rspec (3.13.1)
160
+ rspec (3.13.2)
144
161
  rspec-core (~> 3.13.0)
145
162
  rspec-expectations (~> 3.13.0)
146
163
  rspec-mocks (~> 3.13.0)
147
- rspec-core (3.13.5)
164
+ rspec-core (3.13.6)
148
165
  rspec-support (~> 3.13.0)
149
166
  rspec-expectations (3.13.5)
150
167
  diff-lcs (>= 1.2.0, < 2.0)
151
168
  rspec-support (~> 3.13.0)
152
- rspec-mocks (3.13.5)
169
+ rspec-mocks (3.13.8)
153
170
  diff-lcs (>= 1.2.0, < 2.0)
154
171
  rspec-support (~> 3.13.0)
155
- rspec-support (3.13.6)
156
- rubocop (1.81.1)
172
+ rspec-support (3.13.7)
173
+ rubocop (1.85.1)
157
174
  json (~> 2.3)
158
175
  language_server-protocol (~> 3.17.0.2)
159
176
  lint_roller (~> 1.1.0)
177
+ mcp (~> 0.6)
160
178
  parallel (~> 1.10)
161
179
  parser (>= 3.3.0.2)
162
180
  rainbow (>= 2.2.2, < 4.0)
163
181
  regexp_parser (>= 2.9.3, < 3.0)
164
- rubocop-ast (>= 1.47.1, < 2.0)
182
+ rubocop-ast (>= 1.49.0, < 2.0)
165
183
  ruby-progressbar (~> 1.7)
166
184
  unicode-display_width (>= 2.4.0, < 4.0)
167
- rubocop-ast (1.47.1)
185
+ rubocop-ast (1.49.1)
168
186
  parser (>= 3.3.7.2)
169
- prism (~> 1.4)
170
- rubocop-rspec (3.7.0)
187
+ prism (~> 1.7)
188
+ rubocop-rspec (3.9.0)
171
189
  lint_roller (~> 1.1)
172
- rubocop (~> 1.72, >= 1.72.1)
190
+ rubocop (~> 1.81)
173
191
  ruby-progressbar (1.13.0)
174
192
  scenic (1.9.0)
175
193
  activerecord (>= 4.0.0)
@@ -181,15 +199,15 @@ GEM
181
199
  simplecov_json_formatter (~> 0.1)
182
200
  simplecov-html (0.13.2)
183
201
  simplecov_json_formatter (0.1.4)
184
- stringio (3.1.7)
185
- thor (1.4.0)
186
- timeout (0.4.3)
202
+ stringio (3.2.0)
203
+ thor (1.5.0)
204
+ timeout (0.6.1)
187
205
  tsort (0.2.0)
188
206
  tzinfo (2.0.6)
189
207
  concurrent-ruby (~> 1.0)
190
208
  unicode-display_width (3.2.0)
191
209
  unicode-emoji (~> 4.1)
192
- unicode-emoji (4.1.0)
210
+ unicode-emoji (4.2.0)
193
211
  useragent (0.16.11)
194
212
  zeitwerk (2.6.18)
195
213
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (3.3.0)
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.0.3)
13
- actionview (= 8.0.3)
14
- activesupport (= 8.0.3)
12
+ actionpack (8.0.4)
13
+ actionview (= 8.0.4)
14
+ activesupport (= 8.0.4)
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.0.3)
23
- activesupport (= 8.0.3)
22
+ actionview (8.0.4)
23
+ activesupport (= 8.0.4)
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.0.3)
29
- activesupport (= 8.0.3)
30
- activerecord (8.0.3)
31
- activemodel (= 8.0.3)
32
- activesupport (= 8.0.3)
28
+ activemodel (8.0.4)
29
+ activesupport (= 8.0.4)
30
+ activerecord (8.0.4)
31
+ activemodel (= 8.0.4)
32
+ activesupport (= 8.0.4)
33
33
  timeout (>= 0.4.0)
34
- activesupport (8.0.3)
34
+ activesupport (8.0.4)
35
35
  base64
36
36
  benchmark (>= 0.3)
37
37
  bigdecimal
@@ -44,88 +44,100 @@ 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
- benchmark (0.4.1)
54
- bigdecimal (3.3.1)
55
+ benchmark (0.5.0)
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)
62
- connection_pool (2.5.4)
63
+ concurrent-ruby (1.3.6)
64
+ connection_pool (3.0.2)
63
65
  crass (1.0.6)
64
66
  database_cleaner-active_record (2.2.2)
65
67
  activerecord (>= 5.a)
66
68
  database_cleaner-core (~> 2.0)
67
69
  database_cleaner-core (2.0.1)
68
- date (3.4.1)
70
+ date (3.5.1)
69
71
  diff-lcs (1.6.2)
70
72
  docile (1.4.1)
71
73
  drb (2.2.3)
72
- erb (5.1.1)
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.2)
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.15.1)
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.26.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.9.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.5.2)
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.2.6)
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.3)
123
+ rack (3.2.5)
112
124
  rack-session (2.1.1)
113
125
  base64 (>= 0.1.0)
114
126
  rack (>= 3.0.0)
115
127
  rack-test (2.2.0)
116
128
  rack (>= 1.3)
117
- rackup (2.2.1)
129
+ rackup (2.3.1)
118
130
  rack (>= 3)
119
131
  rails-dom-testing (2.3.0)
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
- railties (8.0.3)
127
- actionpack (= 8.0.3)
128
- activesupport (= 8.0.3)
138
+ railties (8.0.4)
139
+ actionpack (= 8.0.4)
140
+ activesupport (= 8.0.4)
129
141
  irb (~> 1.13)
130
142
  rackup (>= 1.0.0)
131
143
  rake (>= 12.2)
@@ -134,43 +146,44 @@ GEM
134
146
  zeitwerk (~> 2.6)
135
147
  rainbow (3.1.1)
136
148
  rake (13.0.3)
137
- rdoc (6.15.0)
149
+ rdoc (7.2.0)
138
150
  erb
139
151
  psych (>= 4.0.0)
140
152
  tsort
141
153
  regexp_parser (2.11.3)
142
- reline (0.6.2)
154
+ reline (0.6.3)
143
155
  io-console (~> 0.5)
144
- rspec (3.13.1)
156
+ rspec (3.13.2)
145
157
  rspec-core (~> 3.13.0)
146
158
  rspec-expectations (~> 3.13.0)
147
159
  rspec-mocks (~> 3.13.0)
148
- rspec-core (3.13.5)
160
+ rspec-core (3.13.6)
149
161
  rspec-support (~> 3.13.0)
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.5)
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.1)
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.47.1)
181
+ rubocop-ast (1.49.1)
169
182
  parser (>= 3.3.7.2)
170
- prism (~> 1.4)
171
- rubocop-rspec (3.7.0)
183
+ prism (~> 1.7)
184
+ rubocop-rspec (3.9.0)
172
185
  lint_roller (~> 1.1)
173
- rubocop (~> 1.72, >= 1.72.1)
186
+ rubocop (~> 1.81)
174
187
  ruby-progressbar (1.13.0)
175
188
  scenic (1.9.0)
176
189
  activerecord (>= 4.0.0)
@@ -182,16 +195,16 @@ 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.7)
186
- thor (1.4.0)
187
- timeout (0.4.3)
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)
194
- uri (1.0.4)
206
+ unicode-emoji (4.2.0)
207
+ uri (1.1.1)
195
208
  useragent (0.16.11)
196
209
  zeitwerk (2.6.18)
197
210
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- table_saw (3.3.0)
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,105 +44,99 @@ 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)
61
- connection_pool (2.5.4)
62
+ concurrent-ruby (1.3.6)
63
+ connection_pool (3.0.2)
62
64
  crass (1.0.6)
63
65
  database_cleaner-active_record (2.2.2)
64
66
  activerecord (>= 5.a)
65
67
  database_cleaner-core (~> 2.0)
66
68
  database_cleaner-core (2.0.1)
67
- date (3.5.0)
69
+ date (3.5.1)
68
70
  diff-lcs (1.6.2)
69
71
  docile (1.4.1)
70
72
  drb (2.2.3)
71
- erb (5.1.3)
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.15.2)
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.26.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.2.6)
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.3)
122
+ rack (3.2.5)
129
123
  rack-session (2.1.1)
130
124
  base64 (>= 0.1.0)
131
125
  rack (>= 3.0.0)
132
126
  rack-test (2.2.0)
133
127
  rack (>= 1.3)
134
- rackup (2.2.1)
128
+ rackup (2.3.1)
135
129
  rack (>= 3)
136
130
  rails-dom-testing (2.3.0)
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,12 +145,12 @@ GEM
151
145
  zeitwerk (~> 2.6)
152
146
  rainbow (3.1.1)
153
147
  rake (13.0.3)
154
- rdoc (6.15.1)
148
+ rdoc (7.2.0)
155
149
  erb
156
150
  psych (>= 4.0.0)
157
151
  tsort
158
152
  regexp_parser (2.11.3)
159
- reline (0.6.2)
153
+ reline (0.6.3)
160
154
  io-console (~> 0.5)
161
155
  rspec (3.13.2)
162
156
  rspec-core (~> 3.13.0)
@@ -167,27 +161,28 @@ 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.47.1)
180
+ rubocop-ast (1.49.1)
186
181
  parser (>= 3.3.7.2)
187
- prism (~> 1.4)
188
- rubocop-rspec (3.7.0)
182
+ prism (~> 1.7)
183
+ rubocop-rspec (3.9.0)
189
184
  lint_roller (~> 1.1)
190
- rubocop (~> 1.72, >= 1.72.1)
185
+ rubocop (~> 1.81)
191
186
  ruby-progressbar (1.13.0)
192
187
  scenic (1.9.0)
193
188
  activerecord (>= 4.0.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.7)
203
- thor (1.4.0)
204
- timeout (0.4.4)
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)
211
- uri (1.1.0)
205
+ unicode-emoji (4.2.0)
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,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'uri'
4
+
3
5
  module TableSaw
4
6
  class Configuration
5
- attr_writer :variables
7
+ attr_writer :variables, :schemas
6
8
  attr_accessor :dbname, :host, :port, :user, :password, :manifest, :output, :format
7
9
 
8
10
  def connection
@@ -22,5 +24,9 @@ module TableSaw
22
24
  def variables
23
25
  @variables || {}
24
26
  end
27
+
28
+ def schemas
29
+ @schemas || ['public']
30
+ end
25
31
  end
26
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.0'
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.0
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: 3.6.9
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: []