table_saw 3.1.0 → 3.2.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 +4 -4
- data/.github/workflows/ruby.yml +3 -2
- data/.rubocop.yml +1 -1
- data/.tool-versions +1 -1
- data/Appraisals +9 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +87 -82
- data/exe/table-saw +1 -0
- data/gemfiles/activerecord_6.1.0.gemfile +5 -2
- data/gemfiles/activerecord_6.1.0.gemfile.lock +75 -65
- data/gemfiles/activerecord_7.0.0.gemfile +5 -2
- data/gemfiles/activerecord_7.0.0.gemfile.lock +75 -65
- data/gemfiles/activerecord_7.1.0.gemfile +2 -2
- data/gemfiles/activerecord_7.1.0.gemfile.lock +78 -76
- data/gemfiles/activerecord_7.2.0.gemfile +17 -0
- data/gemfiles/activerecord_7.2.0.gemfile.lock +221 -0
- data/lib/table_saw/configuration.rb +1 -1
- data/lib/table_saw/create_dump_file.rb +3 -3
- data/lib/table_saw/dependency_graph/belongs_to_directives.rb +1 -1
- data/lib/table_saw/dependency_graph/build.rb +2 -2
- data/lib/table_saw/dependency_graph/dump_table.rb +1 -1
- data/lib/table_saw/dependency_graph/has_many_directives.rb +1 -1
- data/lib/table_saw/formats/copy.rb +1 -1
- data/lib/table_saw/formats/insert.rb +1 -1
- data/lib/table_saw/manifest.rb +1 -1
- data/lib/table_saw/queries/execute_insert_statement.rb +2 -6
- data/lib/table_saw/queries/foreign_key_relationships.rb +1 -1
- data/lib/table_saw/queries/materialized_views.rb +1 -1
- data/lib/table_saw/queries/prepared_insert_statement.rb +1 -1
- data/lib/table_saw/queries/serial_sequences.rb +1 -1
- data/lib/table_saw/queries/serialize_sql_in_clause.rb +1 -5
- data/lib/table_saw/version.rb +1 -1
- data/lib/table_saw.rb +18 -2
- data/table_saw.gemspec +2 -2
- metadata +8 -7
- data/lib/table_saw/connection.rb +0 -30
@@ -0,0 +1,221 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
table_saw (3.2.0)
|
5
|
+
activerecord (>= 6.1)
|
6
|
+
pg
|
7
|
+
thor
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actionpack (7.2.0)
|
13
|
+
actionview (= 7.2.0)
|
14
|
+
activesupport (= 7.2.0)
|
15
|
+
nokogiri (>= 1.8.5)
|
16
|
+
racc
|
17
|
+
rack (>= 2.2.4, < 3.2)
|
18
|
+
rack-session (>= 1.0.1)
|
19
|
+
rack-test (>= 0.6.3)
|
20
|
+
rails-dom-testing (~> 2.2)
|
21
|
+
rails-html-sanitizer (~> 1.6)
|
22
|
+
useragent (~> 0.16)
|
23
|
+
actionview (7.2.0)
|
24
|
+
activesupport (= 7.2.0)
|
25
|
+
builder (~> 3.1)
|
26
|
+
erubi (~> 1.11)
|
27
|
+
rails-dom-testing (~> 2.2)
|
28
|
+
rails-html-sanitizer (~> 1.6)
|
29
|
+
activemodel (7.2.0)
|
30
|
+
activesupport (= 7.2.0)
|
31
|
+
activerecord (7.2.0)
|
32
|
+
activemodel (= 7.2.0)
|
33
|
+
activesupport (= 7.2.0)
|
34
|
+
timeout (>= 0.4.0)
|
35
|
+
activesupport (7.2.0)
|
36
|
+
base64
|
37
|
+
bigdecimal
|
38
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
39
|
+
connection_pool (>= 2.2.5)
|
40
|
+
drb
|
41
|
+
i18n (>= 1.6, < 2)
|
42
|
+
logger (>= 1.4.2)
|
43
|
+
minitest (>= 5.1)
|
44
|
+
securerandom (>= 0.3)
|
45
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
46
|
+
appraisal (2.5.0)
|
47
|
+
bundler
|
48
|
+
rake
|
49
|
+
thor (>= 0.14.0)
|
50
|
+
ast (2.4.2)
|
51
|
+
base64 (0.2.0)
|
52
|
+
bigdecimal (3.1.8)
|
53
|
+
builder (3.3.0)
|
54
|
+
coderay (1.1.3)
|
55
|
+
combustion (1.5.0)
|
56
|
+
activesupport (>= 3.0.0)
|
57
|
+
railties (>= 3.0.0)
|
58
|
+
thor (>= 0.14.6)
|
59
|
+
concurrent-ruby (1.3.4)
|
60
|
+
connection_pool (2.4.1)
|
61
|
+
crass (1.0.6)
|
62
|
+
database_cleaner-active_record (2.2.0)
|
63
|
+
activerecord (>= 5.a)
|
64
|
+
database_cleaner-core (~> 2.0.0)
|
65
|
+
database_cleaner-core (2.0.1)
|
66
|
+
diff-lcs (1.5.1)
|
67
|
+
docile (1.4.1)
|
68
|
+
drb (2.2.1)
|
69
|
+
erubi (1.13.0)
|
70
|
+
i18n (1.14.5)
|
71
|
+
concurrent-ruby (~> 1.0)
|
72
|
+
io-console (0.7.2)
|
73
|
+
irb (1.14.0)
|
74
|
+
rdoc (>= 4.0.0)
|
75
|
+
reline (>= 0.4.2)
|
76
|
+
json (2.7.2)
|
77
|
+
language_server-protocol (3.17.0.3)
|
78
|
+
logger (1.6.0)
|
79
|
+
loofah (2.22.0)
|
80
|
+
crass (~> 1.0.2)
|
81
|
+
nokogiri (>= 1.12.0)
|
82
|
+
method_source (1.1.0)
|
83
|
+
minitest (5.24.1)
|
84
|
+
nokogiri (1.16.7-aarch64-linux)
|
85
|
+
racc (~> 1.4)
|
86
|
+
nokogiri (1.16.7-arm-linux)
|
87
|
+
racc (~> 1.4)
|
88
|
+
nokogiri (1.16.7-arm64-darwin)
|
89
|
+
racc (~> 1.4)
|
90
|
+
nokogiri (1.16.7-x86-linux)
|
91
|
+
racc (~> 1.4)
|
92
|
+
nokogiri (1.16.7-x86_64-darwin)
|
93
|
+
racc (~> 1.4)
|
94
|
+
nokogiri (1.16.7-x86_64-linux)
|
95
|
+
racc (~> 1.4)
|
96
|
+
parallel (1.26.1)
|
97
|
+
parser (3.3.4.2)
|
98
|
+
ast (~> 2.4.1)
|
99
|
+
racc
|
100
|
+
pg (1.5.7)
|
101
|
+
pry (0.14.2)
|
102
|
+
coderay (~> 1.1)
|
103
|
+
method_source (~> 1.0)
|
104
|
+
psych (5.1.2)
|
105
|
+
stringio
|
106
|
+
racc (1.8.1)
|
107
|
+
rack (3.1.7)
|
108
|
+
rack-session (2.0.0)
|
109
|
+
rack (>= 3.0.0)
|
110
|
+
rack-test (2.1.0)
|
111
|
+
rack (>= 1.3)
|
112
|
+
rackup (2.1.0)
|
113
|
+
rack (>= 3)
|
114
|
+
webrick (~> 1.8)
|
115
|
+
rails-dom-testing (2.2.0)
|
116
|
+
activesupport (>= 5.0.0)
|
117
|
+
minitest
|
118
|
+
nokogiri (>= 1.6)
|
119
|
+
rails-html-sanitizer (1.6.0)
|
120
|
+
loofah (~> 2.21)
|
121
|
+
nokogiri (~> 1.14)
|
122
|
+
railties (7.2.0)
|
123
|
+
actionpack (= 7.2.0)
|
124
|
+
activesupport (= 7.2.0)
|
125
|
+
irb (~> 1.13)
|
126
|
+
rackup (>= 1.0.0)
|
127
|
+
rake (>= 12.2)
|
128
|
+
thor (~> 1.0, >= 1.2.2)
|
129
|
+
zeitwerk (~> 2.6)
|
130
|
+
rainbow (3.1.1)
|
131
|
+
rake (13.0.3)
|
132
|
+
rdoc (6.7.0)
|
133
|
+
psych (>= 4.0.0)
|
134
|
+
regexp_parser (2.9.2)
|
135
|
+
reline (0.5.9)
|
136
|
+
io-console (~> 0.5)
|
137
|
+
rexml (3.3.4)
|
138
|
+
strscan
|
139
|
+
rspec (3.13.0)
|
140
|
+
rspec-core (~> 3.13.0)
|
141
|
+
rspec-expectations (~> 3.13.0)
|
142
|
+
rspec-mocks (~> 3.13.0)
|
143
|
+
rspec-core (3.13.0)
|
144
|
+
rspec-support (~> 3.13.0)
|
145
|
+
rspec-expectations (3.13.1)
|
146
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
147
|
+
rspec-support (~> 3.13.0)
|
148
|
+
rspec-mocks (3.13.1)
|
149
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
150
|
+
rspec-support (~> 3.13.0)
|
151
|
+
rspec-support (3.13.1)
|
152
|
+
rubocop (1.65.1)
|
153
|
+
json (~> 2.3)
|
154
|
+
language_server-protocol (>= 3.17.0)
|
155
|
+
parallel (~> 1.10)
|
156
|
+
parser (>= 3.3.0.2)
|
157
|
+
rainbow (>= 2.2.2, < 4.0)
|
158
|
+
regexp_parser (>= 2.4, < 3.0)
|
159
|
+
rexml (>= 3.2.5, < 4.0)
|
160
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
161
|
+
ruby-progressbar (~> 1.7)
|
162
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
163
|
+
rubocop-ast (1.32.0)
|
164
|
+
parser (>= 3.3.1.0)
|
165
|
+
rubocop-capybara (2.21.0)
|
166
|
+
rubocop (~> 1.41)
|
167
|
+
rubocop-factory_bot (2.26.1)
|
168
|
+
rubocop (~> 1.61)
|
169
|
+
rubocop-rspec (2.31.0)
|
170
|
+
rubocop (~> 1.40)
|
171
|
+
rubocop-capybara (~> 2.17)
|
172
|
+
rubocop-factory_bot (~> 2.22)
|
173
|
+
rubocop-rspec_rails (~> 2.28)
|
174
|
+
rubocop-rspec_rails (2.29.1)
|
175
|
+
rubocop (~> 1.61)
|
176
|
+
ruby-progressbar (1.13.0)
|
177
|
+
scenic (1.8.0)
|
178
|
+
activerecord (>= 4.0.0)
|
179
|
+
railties (>= 4.0.0)
|
180
|
+
securerandom (0.3.1)
|
181
|
+
simplecov (0.22.0)
|
182
|
+
docile (~> 1.1)
|
183
|
+
simplecov-html (~> 0.11)
|
184
|
+
simplecov_json_formatter (~> 0.1)
|
185
|
+
simplecov-html (0.12.3)
|
186
|
+
simplecov_json_formatter (0.1.4)
|
187
|
+
stringio (3.1.1)
|
188
|
+
strscan (3.1.0)
|
189
|
+
thor (1.3.1)
|
190
|
+
timeout (0.4.1)
|
191
|
+
tzinfo (2.0.6)
|
192
|
+
concurrent-ruby (~> 1.0)
|
193
|
+
unicode-display_width (2.5.0)
|
194
|
+
useragent (0.16.10)
|
195
|
+
webrick (1.8.1)
|
196
|
+
zeitwerk (2.6.17)
|
197
|
+
|
198
|
+
PLATFORMS
|
199
|
+
aarch64-linux
|
200
|
+
arm-linux
|
201
|
+
arm64-darwin
|
202
|
+
x86-linux
|
203
|
+
x86_64-darwin
|
204
|
+
x86_64-linux
|
205
|
+
|
206
|
+
DEPENDENCIES
|
207
|
+
activerecord (~> 7.2.0, < 7.3)
|
208
|
+
appraisal
|
209
|
+
bundler (~> 2.0)
|
210
|
+
combustion (~> 1.4)
|
211
|
+
database_cleaner-active_record (~> 2.2)
|
212
|
+
pry
|
213
|
+
rake (= 13.0.3)
|
214
|
+
rspec (~> 3.0)
|
215
|
+
rubocop-rspec (~> 2.3)
|
216
|
+
scenic (~> 1.5)
|
217
|
+
simplecov (~> 0.16)
|
218
|
+
table_saw!
|
219
|
+
|
220
|
+
BUNDLED WITH
|
221
|
+
2.5.9
|
@@ -6,7 +6,7 @@ module TableSaw
|
|
6
6
|
attr_accessor :dbname, :host, :port, :user, :password, :manifest, :output, :format
|
7
7
|
|
8
8
|
def connection
|
9
|
-
{
|
9
|
+
{ adapter: 'postgresql', database: dbname, host:, port:, username: user, password: }
|
10
10
|
end
|
11
11
|
|
12
12
|
def url=(value)
|
@@ -51,9 +51,9 @@ module TableSaw
|
|
51
51
|
|
52
52
|
Array(formatter.header).each { |line| write_to_file(line) }
|
53
53
|
|
54
|
-
TableSaw
|
55
|
-
conn.copy_data "COPY (#{table.copy_statement}) TO STDOUT", formatter.coder do
|
56
|
-
while (row = conn.get_copy_data)
|
54
|
+
TableSaw.connection_pool.with_connection do |conn|
|
55
|
+
conn.raw_connection.copy_data "COPY (#{table.copy_statement}) TO STDOUT", formatter.coder do
|
56
|
+
while (row = conn.raw_connection.get_copy_data)
|
57
57
|
write_to_file formatter.dump_row(row)
|
58
58
|
end
|
59
59
|
end
|
@@ -37,7 +37,7 @@ module TableSaw
|
|
37
37
|
def query_result(foreign_key)
|
38
38
|
return [] unless directive.selectable?
|
39
39
|
|
40
|
-
TableSaw
|
40
|
+
TableSaw.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,
|
@@ -33,7 +33,7 @@ module TableSaw
|
|
33
33
|
if record
|
34
34
|
dir.partial? ? record.fetch_associations(dir) : []
|
35
35
|
else
|
36
|
-
TableSaw::DependencyGraph::DumpTable.new(manifest
|
36
|
+
TableSaw::DependencyGraph::DumpTable.new(manifest:, name: dir.table_name, partial: dir.partial?)
|
37
37
|
.tap { |table| records[dir.table_name] = table }.fetch_associations(dir)
|
38
38
|
end
|
39
39
|
end
|
@@ -41,7 +41,7 @@ module TableSaw
|
|
41
41
|
def select_ids(table)
|
42
42
|
return [] unless table.partial?
|
43
43
|
|
44
|
-
TableSaw
|
44
|
+
TableSaw.connection.exec_query(table.query).map { |row| row[TableSaw.schema_cache.primary_keys(table.name)] }
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -15,7 +15,7 @@ module TableSaw
|
|
15
15
|
def copy_statement
|
16
16
|
if partial
|
17
17
|
format 'select * from %{name} where %{clause}',
|
18
|
-
name
|
18
|
+
name:, clause: TableSaw::Queries::SerializeSqlInClause.new(name, primary_key, ids.to_a).call
|
19
19
|
|
20
20
|
else
|
21
21
|
"select * from #{name}"
|
@@ -40,7 +40,7 @@ module TableSaw
|
|
40
40
|
def query_result(foreign_key)
|
41
41
|
return [] unless directive.selectable?
|
42
42
|
|
43
|
-
TableSaw
|
43
|
+
TableSaw.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
|
23
|
+
.map { |name| TableSaw.connection.quote_column_name(name) }
|
24
24
|
.join(', ')
|
25
25
|
end
|
26
26
|
end
|
@@ -22,7 +22,7 @@ module TableSaw
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def prepared_statement
|
25
|
-
@prepared_statement ||= TableSaw::Queries::PreparedInsertStatement.new(table_name, options:
|
25
|
+
@prepared_statement ||= TableSaw::Queries::PreparedInsertStatement.new(table_name, options:).call
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/lib/table_saw/manifest.rb
CHANGED
@@ -66,7 +66,7 @@ module TableSaw
|
|
66
66
|
def self.instance
|
67
67
|
raise ArgumentError, 'Could not find manifest file' unless File.exist?(TableSaw.configuration.manifest)
|
68
68
|
|
69
|
-
new(YAML.
|
69
|
+
new(YAML.safe_load_file(TableSaw.configuration.manifest))
|
70
70
|
end
|
71
71
|
|
72
72
|
attr_reader :config
|
@@ -22,13 +22,9 @@ module TableSaw
|
|
22
22
|
.join(', ')
|
23
23
|
end
|
24
24
|
|
25
|
-
def adapter
|
26
|
-
TableSaw::Connection.adapter
|
27
|
-
end
|
28
|
-
|
29
25
|
def quote_value(column, value)
|
30
|
-
type =
|
31
|
-
|
26
|
+
type = TableSaw.connection.lookup_cast_type_from_column(column)
|
27
|
+
TableSaw.connection.quote(type.serialize(type.deserialize(value)))
|
32
28
|
end
|
33
29
|
end
|
34
30
|
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
|
35
|
+
.map { |column| TableSaw.connection.quote_column_name(column.name) }
|
36
36
|
.join(', ')
|
37
37
|
end
|
38
38
|
|
@@ -18,7 +18,7 @@ module TableSaw
|
|
18
18
|
SerialSequence = Struct.new(:name, :table, :column)
|
19
19
|
|
20
20
|
def call
|
21
|
-
TableSaw
|
21
|
+
TableSaw.connection.exec_query(QUERY).each_with_object({}) do |row, memo|
|
22
22
|
memo[row['table']] = SerialSequence.new(row['sequence'], row['table'], row['column'])
|
23
23
|
end
|
24
24
|
end
|
@@ -23,13 +23,9 @@ module TableSaw
|
|
23
23
|
|
24
24
|
def serialized_values
|
25
25
|
values.map do |value|
|
26
|
-
connection.quote_default_expression(value, db_column)
|
26
|
+
TableSaw.connection.quote_default_expression(value, db_column)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
def connection
|
31
|
-
TableSaw::Connection.adapter
|
32
|
-
end
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
data/lib/table_saw/version.rb
CHANGED
data/lib/table_saw.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_record'
|
4
|
+
require 'active_support/core_ext/string'
|
5
|
+
|
3
6
|
require 'table_saw/configuration'
|
4
|
-
require 'table_saw/connection'
|
5
7
|
require 'table_saw/dependency_graph'
|
6
8
|
require 'table_saw/information_schema'
|
7
9
|
require 'table_saw/manifest'
|
@@ -29,6 +31,20 @@ module TableSaw
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.schema_cache
|
32
|
-
|
34
|
+
connection.schema_cache
|
35
|
+
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
|
33
48
|
end
|
49
|
+
# :nocov:
|
34
50
|
end
|
data/table_saw.gemspec
CHANGED
@@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = ['table-saw']
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.required_ruby_version = '>= 3.
|
26
|
+
spec.required_ruby_version = '>= 3.1'
|
27
27
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
28
28
|
|
29
|
-
spec.add_dependency 'activerecord', '>= 6.
|
29
|
+
spec.add_dependency 'activerecord', '>= 6.1'
|
30
30
|
spec.add_dependency 'pg'
|
31
31
|
spec.add_dependency 'thor'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_saw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamed Asghari
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
19
|
+
version: '6.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6.
|
26
|
+
version: '6.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,10 +81,11 @@ files:
|
|
81
81
|
- gemfiles/activerecord_7.0.0.gemfile.lock
|
82
82
|
- gemfiles/activerecord_7.1.0.gemfile
|
83
83
|
- gemfiles/activerecord_7.1.0.gemfile.lock
|
84
|
+
- gemfiles/activerecord_7.2.0.gemfile
|
85
|
+
- gemfiles/activerecord_7.2.0.gemfile.lock
|
84
86
|
- lib/table_saw.rb
|
85
87
|
- lib/table_saw/associations.rb
|
86
88
|
- lib/table_saw/configuration.rb
|
87
|
-
- lib/table_saw/connection.rb
|
88
89
|
- lib/table_saw/create_dump_file.rb
|
89
90
|
- lib/table_saw/dependency_graph.rb
|
90
91
|
- lib/table_saw/dependency_graph/add_directive.rb
|
@@ -123,14 +124,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
124
|
requirements:
|
124
125
|
- - ">="
|
125
126
|
- !ruby/object:Gem::Version
|
126
|
-
version: '3.
|
127
|
+
version: '3.1'
|
127
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
130
|
- - ">="
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.5.11
|
134
135
|
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: Create a postgres dump file from a subset of tables
|
data/lib/table_saw/connection.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_record'
|
4
|
-
|
5
|
-
require 'active_record/connection_adapters/abstract/connection_pool'
|
6
|
-
require 'active_record/connection_adapters/postgresql_adapter'
|
7
|
-
|
8
|
-
module TableSaw
|
9
|
-
module Connection
|
10
|
-
def self.with
|
11
|
-
raise ArgumentError, 'requires a block' unless block_given?
|
12
|
-
|
13
|
-
yield adapter.raw_connection
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.exec(sql)
|
17
|
-
TableSaw::Connection.with do |conn|
|
18
|
-
conn.exec(sql)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.adapter
|
23
|
-
@adapter ||= begin
|
24
|
-
config = TableSaw.configuration.connection
|
25
|
-
conn = ::PG::Connection.new(config)
|
26
|
-
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(conn, nil, config, {})
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|