@verdnatura/myt 1.5.30 → 1.5.32
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/myt-pull.js +1 -1
- package/myt-push.js +2 -1
- package/myt-run.js +11 -5
- package/myt.js +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -279,7 +279,7 @@ Builds and starts local database server container. It only rebuilds the image
|
|
|
279
279
|
when dump have been modified.
|
|
280
280
|
|
|
281
281
|
```text
|
|
282
|
-
$ myt run [-c|--ci] [-r|--random]
|
|
282
|
+
$ myt run [-c|--ci] [-r|--random] [-n|--network <string>]
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
### start
|
package/myt-pull.js
CHANGED
package/myt-push.js
CHANGED
|
@@ -461,13 +461,14 @@ class Push extends Command {
|
|
|
461
461
|
const changes = [];
|
|
462
462
|
const changesMap = new Map();
|
|
463
463
|
|
|
464
|
+
const {opts} = this;
|
|
464
465
|
async function pushChanges(diff) {
|
|
465
466
|
if (!diff) return;
|
|
466
467
|
const patches = await diff.patches();
|
|
467
468
|
|
|
468
469
|
for (const patch of patches) {
|
|
469
470
|
const path = patch.newFile().path();
|
|
470
|
-
const match = path.match(
|
|
471
|
+
const match = path.match(opts.routinesRegex);
|
|
471
472
|
if (!match) continue;
|
|
472
473
|
|
|
473
474
|
let change = changesMap.get(match[1]);
|
package/myt-run.js
CHANGED
|
@@ -18,13 +18,15 @@ class Run extends Command {
|
|
|
18
18
|
description: 'Build and start local database server container',
|
|
19
19
|
params: {
|
|
20
20
|
ci: 'Workaround for continuous integration system',
|
|
21
|
-
|
|
21
|
+
network: 'Docker network to attach container to',
|
|
22
|
+
random: 'Whether to use a random container name and port'
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
static opts = {
|
|
26
27
|
alias: {
|
|
27
28
|
ci: 'c',
|
|
29
|
+
network: 'n',
|
|
28
30
|
random: 'r'
|
|
29
31
|
},
|
|
30
32
|
boolean: [
|
|
@@ -104,6 +106,9 @@ class Run extends Command {
|
|
|
104
106
|
} catch (e) {}
|
|
105
107
|
}
|
|
106
108
|
|
|
109
|
+
if (opts.network)
|
|
110
|
+
Object.assign(runOptions, {network: opts.network});
|
|
111
|
+
|
|
107
112
|
const runChown = process.platform != 'linux';
|
|
108
113
|
|
|
109
114
|
Object.assign(runOptions, null, {
|
|
@@ -120,10 +125,11 @@ class Run extends Command {
|
|
|
120
125
|
format: '{{json .NetworkSettings}}'
|
|
121
126
|
});
|
|
122
127
|
|
|
123
|
-
if (opts.ci)
|
|
124
|
-
dbConfig.host = netSettings.
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
if (opts.ci) {
|
|
129
|
+
dbConfig.host = netSettings.Networks[networkName].IPAddress;
|
|
130
|
+
dbConfig.port = 3306;
|
|
131
|
+
} else
|
|
132
|
+
dbConfig.port = netSettings.Ports['3306/tcp'][0].HostPort;
|
|
127
133
|
} catch (err) {
|
|
128
134
|
await server.rm();
|
|
129
135
|
throw err;
|
package/myt.js
CHANGED
|
@@ -205,12 +205,20 @@ class Myt {
|
|
|
205
205
|
Object.assign(opts, config);
|
|
206
206
|
opts.configFile = configFile;
|
|
207
207
|
|
|
208
|
+
const subdir = opts.subdir || '';
|
|
208
209
|
if (!opts.mytDir)
|
|
209
|
-
opts.mytDir = path.join(opts.workspace,
|
|
210
|
+
opts.mytDir = path.join(opts.workspace, subdir);
|
|
210
211
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
const routinesBaseRegex = subdir
|
|
213
|
+
? `${subdir}\/routines`
|
|
214
|
+
: 'routines';
|
|
215
|
+
|
|
216
|
+
Object.assign(opts, {
|
|
217
|
+
routinesRegex: new RegExp(`^${routinesBaseRegex}\/(.+)\.sql$`),
|
|
218
|
+
routinesDir: path.join(opts.mytDir, 'routines'),
|
|
219
|
+
versionsDir: path.join(opts.mytDir, 'versions'),
|
|
220
|
+
dumpDir: path.join(opts.mytDir, 'dump')
|
|
221
|
+
});
|
|
214
222
|
|
|
215
223
|
// Database configuration
|
|
216
224
|
|