master_data_tool 0.12.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/docker-compose.yml +8 -2
- data/exe/master_data_tool +3 -0
- data/lib/master_data_tool/dump/executor.rb +7 -1
- data/lib/master_data_tool/import/executor.rb +2 -0
- data/lib/master_data_tool/report/default_printer.rb +2 -0
- data/lib/master_data_tool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ee8634a9d307fdaa7f6cae268d9955a029309dbd020755ecac87ba0f8f6c4a
|
4
|
+
data.tar.gz: 31c3397ccc5d219fe933b7a0aa856878578fa061c4ab620d4e1dab39312d446c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8409b81d4129b18b0fa489ca0fbaf8a73f5fac79726ee4fed5745bf9312ac24958c6908735fc7a0fc453184e17609348b68e741939b98105547a4de6e1e02315
|
7
|
+
data.tar.gz: f1648f8c1123911468988ea553c1fbe5ad38b81893c5bd376c5f29f983d325672ce8c762020e8f91c7b83cca7d30f3da71919d69e24c11b728cdac7ce044a827
|
data/README.md
CHANGED
@@ -68,12 +68,13 @@ bundle exec thor master_data_tool import \
|
|
68
68
|
|
69
69
|
### ダンプ
|
70
70
|
|
71
|
-
| option | default | 内容
|
72
|
-
|
73
|
-
| --ignore-empty-table | true | 空のテーブルを無視する
|
74
|
-
| --ignore-tables | [] | 指定したテーブルを無視する
|
75
|
-
| --ignore-column-names | [] | 指定したカラムを無視する
|
76
|
-
| --
|
71
|
+
| option | default | 内容 |
|
72
|
+
|-----------------------|---------|-----------------|
|
73
|
+
| --ignore-empty-table | true | 空のテーブルを無視する |
|
74
|
+
| --ignore-tables | [] | 指定したテーブルを無視する |
|
75
|
+
| --ignore-column-names | [] | 指定したカラムを無視する |
|
76
|
+
| --only-tables | nil | 指定したテーブルのみダンプする |
|
77
|
+
| --verbose | false | 詳細表示 |
|
77
78
|
|
78
79
|
```bash
|
79
80
|
bundle exec master_data_tool dump
|
@@ -86,6 +87,7 @@ bundle exec master_data_tool dump \
|
|
86
87
|
--ignore-empty-table=true \
|
87
88
|
--ignore-tables="" \
|
88
89
|
--ignore-column-names="" \
|
90
|
+
--only-tables="" \
|
89
91
|
--verbose=false
|
90
92
|
```
|
91
93
|
|
data/docker-compose.yml
CHANGED
@@ -4,12 +4,18 @@ x-mysql: &mysql
|
|
4
4
|
image: mysql:5.7
|
5
5
|
container_name: master_data_tool_mysql57
|
6
6
|
environment:
|
7
|
-
MYSQL_ROOT_PASSWORD:
|
7
|
+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-f3WpxNreVT2NgQry}
|
8
8
|
platform: linux/x86_64
|
9
9
|
ports:
|
10
|
-
- 127.0.0.1
|
10
|
+
- 127.0.0.1:${DB_PORT:-33306}:3306
|
11
11
|
volumes:
|
12
12
|
- mysql:/var/lib/mysql
|
13
|
+
command: >
|
14
|
+
mysqld
|
15
|
+
--sql-mode=NO_ENGINE_SUBSTITUTION
|
16
|
+
--character-set-server=utf8mb4
|
17
|
+
--innodb-file-per-table=1
|
18
|
+
--innodb-large-prefix
|
13
19
|
|
14
20
|
services:
|
15
21
|
mysql:
|
data/exe/master_data_tool
CHANGED
@@ -28,18 +28,21 @@ module MasterDataTool
|
|
28
28
|
option :ignore_empty_table, default: true, type: :boolean
|
29
29
|
option :ignore_tables, default: [], type: :array
|
30
30
|
option :ignore_column_names, default: [], type: :array
|
31
|
+
option :only_tables, default: nil, type: :array
|
31
32
|
option :verbose, default: false, type: :boolean
|
32
33
|
desc 'dump', 'dump'
|
33
34
|
def dump
|
34
35
|
ignore_empty_table = options[:ignore_empty_table]
|
35
36
|
ignore_tables = options[:ignore_tables]
|
36
37
|
ignore_column_names = options[:ignore_column_names]
|
38
|
+
only_tables = options[:only_tables]
|
37
39
|
verbose = options[:verbose]
|
38
40
|
|
39
41
|
executor = MasterDataTool::Dump::Executor.new(
|
40
42
|
ignore_empty_table: ignore_empty_table,
|
41
43
|
ignore_tables: ignore_tables,
|
42
44
|
ignore_column_names: ignore_column_names,
|
45
|
+
only_tables: only_tables,
|
43
46
|
verbose: verbose
|
44
47
|
)
|
45
48
|
errors = executor.execute
|
@@ -8,10 +8,11 @@ module MasterDataTool
|
|
8
8
|
DEFAULT_IGNORE_TABLES = %w[ar_internal_metadata schema_migrations master_data_statuses]
|
9
9
|
DEFAULT_IGNORE_COLUMNS = %w[created_at updated_at]
|
10
10
|
|
11
|
-
def initialize(ignore_empty_table: true, ignore_tables: [], ignore_column_names: [], verbose: false)
|
11
|
+
def initialize(ignore_empty_table: true, ignore_tables: [], ignore_column_names: [], only_tables: [], verbose: false)
|
12
12
|
@ignore_empty_table = ignore_empty_table
|
13
13
|
@ignore_tables = DEFAULT_IGNORE_TABLES + Array(MasterDataTool.config.dump_ignore_tables) + ignore_tables
|
14
14
|
@ignore_column_names = DEFAULT_IGNORE_COLUMNS + Array(MasterDataTool.config.dump_ignore_columns) + ignore_column_names
|
15
|
+
@only_tables = Array(only_tables)
|
15
16
|
end
|
16
17
|
|
17
18
|
def execute
|
@@ -23,6 +24,11 @@ module MasterDataTool
|
|
23
24
|
next
|
24
25
|
end
|
25
26
|
|
27
|
+
if @only_tables.any? && !@only_tables.include?(table)
|
28
|
+
print_message "[skip] #{table}"
|
29
|
+
next
|
30
|
+
end
|
31
|
+
|
26
32
|
dump_to_csv(table)
|
27
33
|
rescue => e
|
28
34
|
errors << Error.new(table, e)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: master_data_tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|