mysql_db_tool 0.2.0 → 0.2.1
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/README.md +13 -3
- data/bin/mysql_restore +2 -2
- data/lib/mysql_db_tool/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f58a8a6254b856cac959a89c42c2b261f8f2888bb8eb7042b64155c25d67461
|
4
|
+
data.tar.gz: 9e955ad5bb771f353290099daf3b813793bc557c2f72615e39b5a97c8919703e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ae0acb67eecfc7fc4a7a598ed484edd63adece7f4777f92bf23f36843e522d8f3a69aa942cfe499708324d4ff23b7399982ffb4187b61e9f0185689a064d4c
|
7
|
+
data.tar.gz: 461425b16cf7f41ba6a92d10541adc3cedb42e948bf3e12a5dc247c107930011e2dd5b4d04a74f67e82a83587d7e7ffe1c3ee89b1f2f4cd5fb1dbe2ecfcf3825
|
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
|
-
|
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
|
-
|
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
|
-
|
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:
|
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:
|
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
|
|