mysql_db_tool 0.2.0 → 0.2.2

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: 072265e57ad114a3724d8be02c24656ebe8aadb4dca3f0bfa397bdafafb00451
4
- data.tar.gz: 0cb1d78f8b4144669f27c97000419b25c7d3fe3a1a724fd03750b13720528af3
3
+ metadata.gz: 9c70b37689d0fb784905734790283707a98f4956c635fd29a3f17ae19fc18a2c
4
+ data.tar.gz: 71982b0e54f79191e98d34436f9c78f410cbd59db904f00b00cb86c5eacf4fa2
5
5
  SHA512:
6
- metadata.gz: 2cac1bb6cb7de94e1a6415c5980f3ec8067dc3849c164aa36a167b3dd77a901b3391f8aac81da9357dd695675ce8fd1a687df0a09ed8c4d77ea2b58a43f188dd
7
- data.tar.gz: ea432104fb0514200af032ccc619eebbc316b530263678fb0990e8d90dcf60b3b4ea20b07f9d5f7959070592ad62fea53207b65d7e947ce7c21b3073a21ce788
6
+ metadata.gz: eb654e6a3b37d3da2c100db8274d600e167afdb6cdba6100d3a57cf8f22f04ff91706050785d8f310eda2a5aa8902ae6a32a9e58e0dd5285a93a81f7e64754a5
7
+ data.tar.gz: dcea7f1a62444d8e074b7bee219328a4e3a616e719e56ac2baf880d3688c332381c1dc6df793337848023d2186bb1c54268af46b44c4483d61730653ec5ade89
data/README.md CHANGED
@@ -33,12 +33,20 @@ Create a config-<env>.json file under the current directory according to the dat
33
33
  * { "name": "table_name", "where": "column_name" }
34
34
  * ignoreTables - allows you to set which tables should be excluded from backups as unused tables.
35
35
 
36
+ ## Install
37
+
38
+ ```shell
39
+ gem install mysql_db_tool
40
+ ```
41
+
36
42
  ## Data backup
37
43
 
38
44
  ```shell
39
- ./bin/backup -e {env} -i {backup id} -r {run?} --gzip
45
+ mysql_backup -e {env} -i {backup id} -r {run?} --gzip
40
46
  ```
41
47
 
48
+ you can get help by running `mysql_backup -h`
49
+
42
50
  * env - default (local), key to find the configuration file. e.g.) config-local.json
43
51
  * backup id - default (0), ID to use when restoring as a string
44
52
  * run? - Default (false), you can check in advance which command will be executed, if true, it will be executed
@@ -52,9 +60,11 @@ After execution, a directory named "backup-{backup id}" will be created under th
52
60
  ## restore backup data
53
61
 
54
62
  ```shell
55
- ./bin/restore -e {env} -i {backup id} -r {run?} --drop-all-tables
63
+ mysql_restore -e {env} -i {backup id} -r {run?} --drop-all-tables
56
64
  ```
57
65
 
66
+ you can get help by running `mysql_restore -h`
67
+
58
68
  * drop all tables? - Default (false), to keep existing tables, or true, which may cause integration check error if not set to true
59
69
 
60
70
  ## Generate creating db and user sql
@@ -62,7 +72,7 @@ After execution, a directory named "backup-{backup id}" will be created under th
62
72
  You can generate a sql script to create a db and user.
63
73
 
64
74
  ```shell
65
- ./bin/gen_create_db_user {user} {password} {db} {host}
75
+ gen_create_db_user {user} {password} {db} {host}
66
76
  ```
67
77
 
68
78
  ## Installing Ruby
data/bin/mysql_restore CHANGED
@@ -9,7 +9,7 @@ options = {
9
9
  env: "local",
10
10
  id: "0",
11
11
  run: false,
12
- drop_all_tables: true
12
+ drop_all_tables: false
13
13
  }
14
14
 
15
15
  # Parse command line arguments
@@ -20,7 +20,7 @@ OptionParser.new do |opts|
20
20
  MySQLDBTool.id_opt(options, opts)
21
21
  MySQLDBTool.run_opt(options, opts)
22
22
 
23
- opts.on("-d", "--[no-]drop-all-tables", "Drop all tables before restoring (default: enabled)") do |drop_all_tables|
23
+ opts.on("-d", "--[no-]drop-all-tables", "Drop all tables before restoring (default: disabled)") do |drop_all_tables|
24
24
  options[:drop_all_tables] = drop_all_tables
25
25
  end
26
26
 
@@ -46,10 +46,10 @@ module MySQLDBTool
46
46
 
47
47
  gsubstring = sameDb ? "" : databaseMap.map { |k,v| ".gsub(/#{k}/, \"#{v}\")" }.join("")
48
48
 
49
- commands = []
50
-
51
49
  Dir.entries(backupDir).reject {|f| File.directory? f}.sort.flat_map do |f|
52
50
 
51
+ commands = []
52
+
53
53
  index, origin_database = split_integer_and_string(f)
54
54
  database = get_element_or_last(databases, index)
55
55
 
@@ -1,5 +1,5 @@
1
1
  # lib/mysql_db_tool/version.rb
2
2
 
3
3
  module MySQLDBTool
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_db_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soonoh Jung