@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 CHANGED
@@ -50,7 +50,7 @@ class Pull extends Command {
50
50
  const match = patch
51
51
  .newFile()
52
52
  .path()
53
- .match(/^routines\/(.+)\.sql$/);
53
+ .match(opts.routinesRegex);
54
54
  if (match) return true;
55
55
  }
56
56
 
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(/^routines\/(.+)\.sql$/);
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, opts.subdir || '');
210
+ opts.mytDir = path.join(opts.workspace, subdir);
210
211
 
211
- opts.routinesDir = path.join(opts.mytDir, 'routines');
212
- opts.versionsDir = path.join(opts.mytDir, 'versions');
213
- opts.dumpDir = path.join(opts.mytDir, 'dump');
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdnatura/myt",
3
- "version": "1.5.30",
3
+ "version": "1.5.31",
4
4
  "author": "Verdnatura Levante SL",
5
5
  "description": "MySQL version control",
6
6
  "license": "GPL-3.0",