@verdnatura/myt 1.5.30 → 1.5.31
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/myt-pull.js +1 -1
- package/myt-push.js +2 -1
- package/myt.js +12 -4
- package/package.json +1 -1
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.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
|
|