@verdnatura/myt 1.5.16 → 1.5.17
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.
- package/README.md +1 -1
- package/lib/dumper.js +2 -2
- package/myt-dump.js +17 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ Exports database structure and fixtures from remote into hidden files located
|
|
|
221
221
|
in *dump* folder. If no remote is specified *production* is used.
|
|
222
222
|
|
|
223
223
|
```text
|
|
224
|
-
$ myt dump [<remote>]
|
|
224
|
+
$ myt dump [<remote>] [-l|--lock]
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
### fixtures
|
package/lib/dumper.js
CHANGED
|
@@ -35,7 +35,7 @@ module.exports = class Dumper {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
async dumpFixtures(tables, replace) {
|
|
38
|
+
async dumpFixtures(tables, replace, args) {
|
|
39
39
|
const fixturesArgs = [
|
|
40
40
|
'--no-create-info',
|
|
41
41
|
'--skip-triggers',
|
|
@@ -45,7 +45,7 @@ module.exports = class Dumper {
|
|
|
45
45
|
'--skip-set-charset',
|
|
46
46
|
'--skip-comments',
|
|
47
47
|
'--skip-tz-utc'
|
|
48
|
-
];
|
|
48
|
+
].concat(args);
|
|
49
49
|
|
|
50
50
|
if (replace)
|
|
51
51
|
fixturesArgs.push('--replace');
|
package/myt-dump.js
CHANGED
|
@@ -6,18 +6,30 @@ const Dumper = require('./lib/dumper');
|
|
|
6
6
|
class Dump extends Command {
|
|
7
7
|
static usage = {
|
|
8
8
|
description: 'Dumps structure and fixtures from remote',
|
|
9
|
+
params: {
|
|
10
|
+
lock: 'Whether to lock tables on dump'
|
|
11
|
+
},
|
|
9
12
|
operand: 'remote'
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
static opts = {
|
|
13
16
|
default: {
|
|
14
17
|
remote: 'production'
|
|
15
|
-
}
|
|
18
|
+
},
|
|
19
|
+
alias: {
|
|
20
|
+
lock: 'l'
|
|
21
|
+
},
|
|
22
|
+
boolean: [
|
|
23
|
+
'lock'
|
|
24
|
+
]
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
async run(myt, opts) {
|
|
19
28
|
const dumper = new Dumper(opts);
|
|
20
29
|
await dumper.init('.dump.sql');
|
|
30
|
+
const baseArgs = [
|
|
31
|
+
`--lock-tables=${opts.lock ? 'true' : 'false'}`
|
|
32
|
+
];
|
|
21
33
|
|
|
22
34
|
console.log('Dumping structure.');
|
|
23
35
|
let dumpArgs = [
|
|
@@ -28,12 +40,13 @@ class Dump extends Command {
|
|
|
28
40
|
'--events',
|
|
29
41
|
'--skip-triggers',
|
|
30
42
|
'--databases'
|
|
31
|
-
];
|
|
43
|
+
].concat(baseArgs);
|
|
44
|
+
|
|
32
45
|
dumpArgs = dumpArgs.concat(opts.schemas);
|
|
33
46
|
await dumper.runDump('docker-dump.sh', dumpArgs);
|
|
34
47
|
|
|
35
48
|
console.log('Dumping fixtures.');
|
|
36
|
-
await dumper.dumpFixtures(opts.fixtures);
|
|
49
|
+
await dumper.dumpFixtures(opts.fixtures, false, baseArgs);
|
|
37
50
|
|
|
38
51
|
console.log('Dumping privileges.');
|
|
39
52
|
const privs = opts.privileges;
|
|
@@ -43,7 +56,7 @@ class Dump extends Command {
|
|
|
43
56
|
'--skip-triggers',
|
|
44
57
|
'--insert-ignore',
|
|
45
58
|
'--complete-insert'
|
|
46
|
-
];
|
|
59
|
+
].concat(baseArgs);
|
|
47
60
|
if (privs.where) args.push('--where', privs.where);
|
|
48
61
|
args = args.concat(['mysql'], privs.tables);
|
|
49
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdnatura/myt",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.17",
|
|
4
4
|
"author": "Verdnatura Levante SL",
|
|
5
5
|
"description": "MySQL version control",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@sqltools/formatter": "^1.2.5",
|
|
16
16
|
"colors": "^1.4.0",
|
|
17
|
-
"ejs": "^3.1.
|
|
17
|
+
"ejs": "^3.1.9",
|
|
18
18
|
"fs-extra": "^8.1.0",
|
|
19
19
|
"getopts": "^2.3.0",
|
|
20
20
|
"ini": "^1.3.8",
|
|
21
21
|
"mysql2": "^2.3.3",
|
|
22
22
|
"nodegit": "^0.27.0",
|
|
23
|
-
"require-yaml": "0.0.1",
|
|
23
|
+
"require-yaml": "^0.0.1",
|
|
24
24
|
"sha.js": "^2.4.11"
|
|
25
25
|
},
|
|
26
26
|
"main": "index.js",
|