master_data_tool 0.21.1 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/master_data_tool +3 -65
- data/lib/master_data_tool/act_as_master_data.rb +13 -0
- data/lib/master_data_tool/command/dump.rb +43 -0
- data/lib/master_data_tool/command/import.rb +86 -0
- data/lib/master_data_tool/command/verify.rb +64 -0
- data/lib/master_data_tool/command.rb +5 -0
- data/lib/master_data_tool/config.rb +2 -2
- data/lib/master_data_tool/dump/config.rb +42 -0
- data/lib/master_data_tool/dump/executor.rb +9 -15
- data/lib/master_data_tool/dump.rb +1 -0
- data/lib/master_data_tool/import/config.rb +35 -0
- data/lib/master_data_tool/import/executor.rb +49 -76
- data/lib/master_data_tool/import.rb +1 -0
- data/lib/master_data_tool/master_data.rb +48 -36
- data/lib/master_data_tool/master_data_collection.rb +1 -1
- data/lib/master_data_tool/master_data_file.rb +4 -4
- data/lib/master_data_tool/master_data_file_collection.rb +10 -8
- data/lib/master_data_tool/master_data_status.rb +18 -9
- data/lib/master_data_tool/report/core.rb +2 -2
- data/lib/master_data_tool/report/default_printer.rb +1 -1
- data/lib/master_data_tool/report/import_report.rb +13 -15
- data/lib/master_data_tool/report/print_affected_table_report.rb +2 -2
- data/lib/master_data_tool/report/printer.rb +2 -2
- data/lib/master_data_tool/report/verify_report.rb +8 -8
- data/lib/master_data_tool/spec_config.rb +8 -10
- data/lib/master_data_tool/verify/config.rb +39 -0
- data/lib/master_data_tool/verify/executor.rb +39 -0
- data/lib/master_data_tool/verify.rb +4 -0
- data/lib/master_data_tool/version.rb +1 -1
- data/lib/master_data_tool.rb +21 -3
- data/sig/master_data_tool.rbs +323 -171
- metadata +38 -15
- data/LICENSE +0 -21
- data/README.md +0 -242
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6232c3b6ae362cffd34640cd73539eb95423952013d5c37d49f23e54407f075
|
4
|
+
data.tar.gz: 96378ffa854e3743e75b977219e5727992c0732455f92e417d4bd428e635c7f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d730d66002a0f74a6f1600077e30a1df4d4481eee665328fb0d2aa151763a0800112cc073165efe9e5c9df6dd50135348416c296d4b5c8d08ae5c7265c5c9cf
|
7
|
+
data.tar.gz: 685e1be7c64b7b61627c08499bd43c5517e8637c203925e9b4f0e8997bdfbc9fe86c3d2d8f6a29500f8bbe754be65be409e3d806a69ba65f53d5940992ca7278
|
data/exe/master_data_tool
CHANGED
@@ -9,71 +9,9 @@ require environment_path
|
|
9
9
|
|
10
10
|
module MasterDataTool
|
11
11
|
class CLI < Thor
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
option :only_import_tables, default: nil, type: :array
|
16
|
-
option :except_import_tables, default: nil, type: :array
|
17
|
-
option :only_verify_tables, default: nil, type: :array
|
18
|
-
option :except_verify_tables, default: nil, type: :array
|
19
|
-
option :skip_no_change, default: nil, type: :boolean
|
20
|
-
option :silent, default: nil, type: :boolean
|
21
|
-
option :override_identifier, default: nil, type: :string
|
22
|
-
option :delete_all_ignore_foreign_key, default: nil, type: :boolean
|
23
|
-
desc 'import', 'import'
|
24
|
-
def import
|
25
|
-
spec_config = MasterDataTool.config.spec_config(options['spec_name'])
|
26
|
-
new_options = config.default_import_options.with_indifferent_access.merge(options)
|
27
|
-
new_options[:spec_config] = spec_config
|
28
|
-
|
29
|
-
executor = MasterDataTool::Import::Executor.new(**new_options.symbolize_keys)
|
30
|
-
executor.execute
|
31
|
-
end
|
32
|
-
|
33
|
-
option :dry_run, default: nil, type: :boolean
|
34
|
-
option :verify, default: nil, type: :boolean
|
35
|
-
option :skip_no_change, default: nil, type: :boolean
|
36
|
-
desc 'import_all', 'import all'
|
37
|
-
def import_all
|
38
|
-
MasterDataTool.config.spec_configs.each do |spec_config|
|
39
|
-
new_options = spec_config.default_import_options.with_indifferent_access.merge(options)
|
40
|
-
new_options[:spec_config] = spec_config
|
41
|
-
|
42
|
-
executor = MasterDataTool::Import::Executor.new(**new_options.symbolize_keys)
|
43
|
-
executor.execute
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
option :spec_name, default: nil, type: :string
|
48
|
-
option :ignore_empty_table, default: true, type: :boolean
|
49
|
-
option :ignore_tables, default: [], type: :array
|
50
|
-
option :ignore_column_names, default: [], type: :array
|
51
|
-
option :only_tables, default: nil, type: :array
|
52
|
-
option :verbose, default: false, type: :boolean
|
53
|
-
desc 'dump', 'dump'
|
54
|
-
def dump
|
55
|
-
ignore_empty_table = options[:ignore_empty_table]
|
56
|
-
ignore_tables = options[:ignore_tables]
|
57
|
-
ignore_column_names = options[:ignore_column_names]
|
58
|
-
only_tables = options[:only_tables]
|
59
|
-
verbose = options[:verbose]
|
60
|
-
spec_config = MasterDataTool.config.spec_config(options['spec_name'])
|
61
|
-
|
62
|
-
executor = MasterDataTool::Dump::Executor.new(
|
63
|
-
spec_config: spec_config,
|
64
|
-
ignore_empty_table: ignore_empty_table,
|
65
|
-
ignore_tables: ignore_tables,
|
66
|
-
ignore_column_names: ignore_column_names,
|
67
|
-
only_tables: only_tables,
|
68
|
-
verbose: verbose
|
69
|
-
)
|
70
|
-
errors = executor.execute
|
71
|
-
|
72
|
-
return if errors.empty?
|
73
|
-
|
74
|
-
message = errors.map { |error| "table:#{error.table}\tmessage:#{error.exception.message}" }.join("\n")
|
75
|
-
raise message
|
76
|
-
end
|
12
|
+
include MasterDataTool::Command::Import
|
13
|
+
include MasterDataTool::Command::Verify
|
14
|
+
include MasterDataTool::Command::Dump
|
77
15
|
end
|
78
16
|
end
|
79
17
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module MasterDataTool
|
2
|
+
module Command
|
3
|
+
module Dump
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
desc 'dump', 'dump'
|
8
|
+
|
9
|
+
option :spec_name, default: nil, type: :string
|
10
|
+
|
11
|
+
option :ignore_empty_table, default: MasterDataTool::Dump::Config::DEFAULT_VALUES[:ignore_empty_table], type: :boolean
|
12
|
+
option :ignore_tables, default: MasterDataTool::Dump::Config::DEFAULT_VALUES[:ignore_tables], type: :array
|
13
|
+
option :ignore_column_names, default: MasterDataTool::Dump::Config::DEFAULT_VALUES[:ignore_column_names], type: :array
|
14
|
+
option :only_tables, default: MasterDataTool::Dump::Config::DEFAULT_VALUES[:only_tables], type: :array
|
15
|
+
option :verbose, default: false, type: :boolean
|
16
|
+
|
17
|
+
def dump
|
18
|
+
spec_config = MasterDataTool.config.spec_config(options[:spec_name])
|
19
|
+
raise "正しいspec_nameを指定して下さい" unless spec_config
|
20
|
+
|
21
|
+
dump_config = spec_config.dump_config || MasterDataTool::Dump::Config.new(
|
22
|
+
ignore_empty_table: options[:ignore_empty_table],
|
23
|
+
ignore_tables: options[:ignore_tables],
|
24
|
+
ignore_column_names: options[:ignore_column_names],
|
25
|
+
only_tables: options[:only_tables]
|
26
|
+
)
|
27
|
+
|
28
|
+
executor = MasterDataTool::Dump::Executor.new(
|
29
|
+
spec_config: spec_config,
|
30
|
+
dump_config: dump_config,
|
31
|
+
verbose: options[:verbose]
|
32
|
+
)
|
33
|
+
errors = executor.execute
|
34
|
+
|
35
|
+
return if errors.empty?
|
36
|
+
|
37
|
+
message = errors.map { |error| "table:#{error.table}\tmessage:#{error.exception.message}" }.join("\n")
|
38
|
+
raise message
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module MasterDataTool
|
2
|
+
module Command
|
3
|
+
module Import
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
option :spec_name, default: nil, type: :string
|
8
|
+
option :dry_run, default: true, type: :boolean
|
9
|
+
option :verify, default: true, type: :boolean
|
10
|
+
option :silent, default: false, type: :boolean
|
11
|
+
option :override_identifier, default: nil, type: :string
|
12
|
+
|
13
|
+
# import config
|
14
|
+
option :only_import_tables, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:only_tables], type: :array
|
15
|
+
option :except_import_tables, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:except_tables], type: :array
|
16
|
+
option :skip_no_change, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:skip_no_change], type: :boolean
|
17
|
+
option :ignore_foreign_key_when_delete, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:ignore_foreign_key_when_delete], type: :boolean
|
18
|
+
|
19
|
+
# verify config
|
20
|
+
option :only_verify_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:only_tables], type: :array
|
21
|
+
option :except_verify_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:except_tables], type: :array
|
22
|
+
option :preload_belongs_to_associations, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:preload_belongs_to_associations], type: :boolean
|
23
|
+
|
24
|
+
desc 'import', 'import'
|
25
|
+
def import
|
26
|
+
spec_config = MasterDataTool.config.spec_config(options[:spec_name])
|
27
|
+
raise "正しいspec_nameを指定して下さい" unless spec_config
|
28
|
+
|
29
|
+
build_import_executor(spec_config).execute
|
30
|
+
end
|
31
|
+
|
32
|
+
option :dry_run, default: true, type: :boolean
|
33
|
+
option :verify, default: true, type: :boolean
|
34
|
+
option :silent, default: false, type: :boolean
|
35
|
+
option :override_identifier, default: nil, type: :string
|
36
|
+
|
37
|
+
# import config
|
38
|
+
option :only_import_tables, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:only_tables], type: :array
|
39
|
+
option :except_import_tables, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:except_tables], type: :array
|
40
|
+
option :skip_no_change, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:skip_no_change], type: :boolean
|
41
|
+
option :ignore_foreign_key_when_delete, default: MasterDataTool::Import::Config::DEFAULT_VALUES[:ignore_foreign_key_when_delete], type: :boolean
|
42
|
+
|
43
|
+
# verify config
|
44
|
+
option :only_verify_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:only_tables], type: :array
|
45
|
+
option :except_verify_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:except_tables], type: :array
|
46
|
+
option :preload_belongs_to_associations, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:preload_belongs_to_associations], type: :boolean
|
47
|
+
|
48
|
+
desc 'import_all', 'import all'
|
49
|
+
def import_all
|
50
|
+
MasterDataTool.config.spec_configs.each do |spec_config|
|
51
|
+
build_import_executor(spec_config).execute
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def build_import_executor(spec_config)
|
58
|
+
import_config = spec_config.import_config || MasterDataTool::Import::Config.new(
|
59
|
+
only_tables: options[:only_import_tables],
|
60
|
+
except_tables: options[:except_import_tables],
|
61
|
+
skip_no_change: options[:skip_no_change],
|
62
|
+
ignore_foreign_key_when_delete: options[:ignore_foreign_key_when_delete]
|
63
|
+
)
|
64
|
+
|
65
|
+
verify_config = spec_config.verify_config || MasterDataTool::Verify::Config.new(
|
66
|
+
only_tables: options[:only_verify_tables],
|
67
|
+
except_tables: options[:except_verify_tables],
|
68
|
+
preload_belongs_to_associations: options[:preload_belongs_to_associations],
|
69
|
+
preload_associations: {},
|
70
|
+
eager_load_associations: {}
|
71
|
+
)
|
72
|
+
|
73
|
+
MasterDataTool::Import::Executor.new(
|
74
|
+
spec_config: spec_config,
|
75
|
+
import_config: import_config,
|
76
|
+
verify_config: verify_config,
|
77
|
+
dry_run: options[:dry_run],
|
78
|
+
verify: options[:verify],
|
79
|
+
silent: options[:silent],
|
80
|
+
override_identifier: options[:override_identifier]
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module MasterDataTool
|
2
|
+
module Command
|
3
|
+
module Verify
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
desc 'verify', 'verify'
|
8
|
+
|
9
|
+
option :spec_name, default: nil, type: :string
|
10
|
+
option :verify, default: true, type: :boolean
|
11
|
+
option :silent, default: false, type: :boolean
|
12
|
+
option :override_identifier, default: nil, type: :string
|
13
|
+
|
14
|
+
# verify config
|
15
|
+
option :only_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:only_tables], type: :array
|
16
|
+
option :except_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:except_tables], type: :array
|
17
|
+
option :preload_belongs_to_associations, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:preload_belongs_to_associations], type: :boolean
|
18
|
+
|
19
|
+
def verify
|
20
|
+
spec_config = MasterDataTool.config.spec_config(options[:spec_name])
|
21
|
+
raise "正しいspec_nameを指定して下さい" unless spec_config
|
22
|
+
|
23
|
+
build_verify_executor(spec_config).execute
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'verify_all', 'verify all'
|
27
|
+
|
28
|
+
option :verify, default: true, type: :boolean
|
29
|
+
option :silent, default: false, type: :boolean
|
30
|
+
option :override_identifier, default: nil, type: :string
|
31
|
+
|
32
|
+
# verify config
|
33
|
+
option :only_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:only_tables], type: :array
|
34
|
+
option :except_tables, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:except_tables], type: :array
|
35
|
+
option :preload_belongs_to_associations, default: MasterDataTool::Verify::Config::DEFAULT_VALUES[:preload_belongs_to_associations], type: :boolean
|
36
|
+
|
37
|
+
def verify_all
|
38
|
+
MasterDataTool.config.spec_configs.each do |spec_config|
|
39
|
+
build_verify_executor(spec_config).execute
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def build_verify_executor(spec_config)
|
46
|
+
verify_config = spec_config.verify_config || MasterDataTool::Verify::Config.new(
|
47
|
+
only_tables: options[:only_tables],
|
48
|
+
except_tables: options[:except_tables],
|
49
|
+
preload_belongs_to_associations: options[:preload_belongs_to_associations],
|
50
|
+
preload_associations: {},
|
51
|
+
eager_load_associations: {}
|
52
|
+
)
|
53
|
+
|
54
|
+
MasterDataTool::Verify::Executor.new(
|
55
|
+
spec_config: spec_config,
|
56
|
+
verify_config: verify_config,
|
57
|
+
silent: options[:silent],
|
58
|
+
override_identifier: options[:override_identifier]
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -13,10 +13,10 @@ module MasterDataTool
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def spec_config(spec_name)
|
16
|
-
spec_configs.detect { |c| c.spec_name == spec_name }
|
16
|
+
spec_configs.detect { |c| c.spec_name.to_s == spec_name.to_s }
|
17
17
|
end
|
18
18
|
|
19
|
-
def csv_dir_for(spec_name
|
19
|
+
def csv_dir_for(spec_name:, override_identifier: nil)
|
20
20
|
path = MasterDataTool.config.master_data_dir
|
21
21
|
path = path.join(spec_name.to_s) if spec_name.present?
|
22
22
|
path = path.join(override_identifier.to_s) if override_identifier.present?
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module MasterDataTool
|
2
|
+
module Dump
|
3
|
+
class Config
|
4
|
+
DEFAULT_IGNORE_TABLES = %w[ar_internal_metadata schema_migrations master_data_statuses]
|
5
|
+
DEFAULT_IGNORE_COLUMNS = %w[created_at updated_at]
|
6
|
+
|
7
|
+
DEFAULT_VALUES = {
|
8
|
+
ignore_empty_table: true,
|
9
|
+
ignore_tables: [],
|
10
|
+
ignore_column_names: [],
|
11
|
+
only_tables: [],
|
12
|
+
}
|
13
|
+
|
14
|
+
attr_accessor :ignore_empty_table, :ignore_tables, :ignore_column_names, :only_tables
|
15
|
+
|
16
|
+
def initialize(ignore_empty_table:, ignore_tables:, ignore_column_names:, only_tables:)
|
17
|
+
@ignore_empty_table = ignore_empty_table
|
18
|
+
@ignore_tables = DEFAULT_IGNORE_TABLES + ignore_tables
|
19
|
+
@ignore_column_names = DEFAULT_IGNORE_COLUMNS + ignore_column_names
|
20
|
+
@only_tables = only_tables
|
21
|
+
end
|
22
|
+
|
23
|
+
def configure
|
24
|
+
yield self
|
25
|
+
end
|
26
|
+
|
27
|
+
def ignore_tables=(tables)
|
28
|
+
@ignore_tables = (DEFAULT_IGNORE_TABLES + tables).uniq
|
29
|
+
end
|
30
|
+
|
31
|
+
def ignore_column_names=(column_names)
|
32
|
+
@ignore_column_names = (DEFAULT_IGNORE_COLUMNS + column_names).uniq
|
33
|
+
end
|
34
|
+
|
35
|
+
class << self
|
36
|
+
def default_config
|
37
|
+
new(**DEFAULT_VALUES)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -5,34 +5,28 @@ module MasterDataTool
|
|
5
5
|
class Executor
|
6
6
|
Error = Struct.new(:table, :exception)
|
7
7
|
|
8
|
-
|
9
|
-
DEFAULT_IGNORE_COLUMNS = %w[created_at updated_at]
|
10
|
-
|
11
|
-
def initialize(spec_config:, ignore_empty_table: true, ignore_tables: [], ignore_column_names: [], only_tables: [], verbose: false)
|
8
|
+
def initialize(spec_config:, dump_config:, verbose: false)
|
12
9
|
@spec_config = spec_config
|
13
|
-
@
|
14
|
-
@ignore_tables = DEFAULT_IGNORE_TABLES + Array(spec_config.dump_ignore_tables) + ignore_tables
|
15
|
-
@ignore_column_names = DEFAULT_IGNORE_COLUMNS + Array(spec_config.dump_ignore_columns) + ignore_column_names
|
16
|
-
@only_tables = Array(only_tables)
|
10
|
+
@dump_config = dump_config
|
17
11
|
@verbose = verbose
|
18
12
|
end
|
19
13
|
|
20
14
|
def execute
|
21
15
|
[].tap do |errors|
|
22
16
|
spec_config.application_record_class.connection.tables.each do |table|
|
23
|
-
if ignore_tables.include?(table)
|
17
|
+
if dump_config.ignore_tables.include?(table)
|
24
18
|
print_message "[ignore] #{table}"
|
25
19
|
|
26
20
|
next
|
27
21
|
end
|
28
22
|
|
29
|
-
if only_tables.any? && !only_tables.include?(table)
|
23
|
+
if dump_config.only_tables.any? && !dump_config.only_tables.include?(table)
|
30
24
|
print_message "[skip] #{table}"
|
31
25
|
next
|
32
26
|
end
|
33
27
|
|
34
28
|
dump_to_csv(table)
|
35
|
-
rescue => e
|
29
|
+
rescue StandardError => e
|
36
30
|
errors << Error.new(table, e)
|
37
31
|
end
|
38
32
|
end
|
@@ -40,7 +34,7 @@ module MasterDataTool
|
|
40
34
|
|
41
35
|
private
|
42
36
|
|
43
|
-
attr_reader :spec_config, :
|
37
|
+
attr_reader :spec_config, :dump_config, :verbose
|
44
38
|
|
45
39
|
def print_message(message)
|
46
40
|
return unless verbose
|
@@ -56,11 +50,11 @@ module MasterDataTool
|
|
56
50
|
return
|
57
51
|
end
|
58
52
|
|
59
|
-
csv_path = MasterDataTool.config.csv_dir_for(spec_config.spec_name).join("#{table}.csv")
|
53
|
+
csv_path = MasterDataTool.config.csv_dir_for(spec_name: spec_config.spec_name).join("#{table}.csv")
|
60
54
|
FileUtils.mkdir_p(csv_path.dirname)
|
61
55
|
|
62
56
|
CSV.open(csv_path, 'w', force_quotes: true) do |csv|
|
63
|
-
headers = model_klass.column_names - ignore_column_names
|
57
|
+
headers = model_klass.column_names - dump_config.ignore_column_names
|
64
58
|
|
65
59
|
csv << headers
|
66
60
|
|
@@ -76,7 +70,7 @@ module MasterDataTool
|
|
76
70
|
end
|
77
71
|
|
78
72
|
def ignore?(model_klass)
|
79
|
-
return false unless ignore_empty_table
|
73
|
+
return false unless dump_config.ignore_empty_table
|
80
74
|
|
81
75
|
model_klass.count < 1
|
82
76
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module MasterDataTool
|
2
|
+
module Import
|
3
|
+
class Config
|
4
|
+
DEFAULT_VALUES = {
|
5
|
+
only_tables: [],
|
6
|
+
except_tables: [],
|
7
|
+
skip_no_change: true,
|
8
|
+
ignore_foreign_key_when_delete: true,
|
9
|
+
}
|
10
|
+
|
11
|
+
attr_accessor :only_tables, :except_tables, :skip_no_change, :ignore_foreign_key_when_delete
|
12
|
+
|
13
|
+
def initialize(only_tables:, except_tables:, skip_no_change:, ignore_foreign_key_when_delete:)
|
14
|
+
@only_tables = only_tables
|
15
|
+
@except_tables = except_tables
|
16
|
+
@skip_no_change = skip_no_change
|
17
|
+
@ignore_foreign_key_when_delete = ignore_foreign_key_when_delete
|
18
|
+
end
|
19
|
+
|
20
|
+
def skip_table?(table_name)
|
21
|
+
MasterDataTool.need_skip_table?(table_name, only_tables, except_tables)
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure
|
25
|
+
yield self
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def default_config
|
30
|
+
new(**DEFAULT_VALUES)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|