retold-data-service 2.0.26 → 2.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retold-data-service",
3
- "version": "2.0.26",
3
+ "version": "2.0.28",
4
4
  "description": "Serve up a whole model!",
5
5
  "main": "source/Retold-Data-Service.js",
6
6
  "bin": {
@@ -73,7 +73,7 @@
73
73
  "meadow-connection-mysql": "^1.0.14",
74
74
  "meadow-endpoints": "^4.0.15",
75
75
  "meadow-integration": "^1.0.21",
76
- "meadow-migrationmanager": "^0.0.4",
76
+ "meadow-migrationmanager": "^0.0.6",
77
77
  "orator": "^6.0.4",
78
78
  "orator-http-proxy": "^1.0.5",
79
79
  "orator-serviceserver-restify": "^2.0.10",
@@ -426,6 +426,7 @@ module.exports = (pDataClonerService, pOratorServiceServer) =>
426
426
  let tmpDiff = tmpMM._schemaDiff.diffSchemas(tmpSourceSchema, tmpTargetSchema);
427
427
 
428
428
  let tmpColumnsAdded = [];
429
+ let tmpColumnsModified = [];
429
430
  if (tmpDiff.TablesModified && tmpDiff.TablesModified.length > 0)
430
431
  {
431
432
  for (let t = 0; t < tmpDiff.TablesModified.length; t++)
@@ -438,10 +439,17 @@ module.exports = (pDataClonerService, pOratorServiceServer) =>
438
439
  tmpColumnsAdded.push(tmpMod.ColumnsAdded[c].Column);
439
440
  }
440
441
  }
442
+ if (Array.isArray(tmpMod.ColumnsModified))
443
+ {
444
+ for (let c = 0; c < tmpMod.ColumnsModified.length; c++)
445
+ {
446
+ tmpColumnsModified.push(tmpMod.ColumnsModified[c].Column);
447
+ }
448
+ }
441
449
  }
442
450
  }
443
451
 
444
- if (tmpColumnsAdded.length < 1)
452
+ if (tmpColumnsAdded.length < 1 && tmpColumnsModified.length < 1)
445
453
  {
446
454
  return fNextTable();
447
455
  }
@@ -449,7 +457,16 @@ module.exports = (pDataClonerService, pOratorServiceServer) =>
449
457
  // Generate provider-appropriate ALTER TABLE statements
450
458
  let tmpStatements = tmpMM._migrationGenerator.generateMigrationStatements(tmpDiff, tmpProviderName);
451
459
 
452
- tmpFable.log.info(`Data Cloner: Migrating ${pTableName} — adding ${tmpColumnsAdded.length} column(s): [${tmpColumnsAdded.join(', ')}]`);
460
+ let tmpLogParts = [];
461
+ if (tmpColumnsAdded.length > 0)
462
+ {
463
+ tmpLogParts.push(`adding ${tmpColumnsAdded.length} column(s): [${tmpColumnsAdded.join(', ')}]`);
464
+ }
465
+ if (tmpColumnsModified.length > 0)
466
+ {
467
+ tmpLogParts.push(`modifying ${tmpColumnsModified.length} column(s): [${tmpColumnsModified.join(', ')}]`);
468
+ }
469
+ tmpFable.log.info(`Data Cloner: Migrating ${pTableName} — ${tmpLogParts.join('; ')}`);
453
470
 
454
471
  let tmpExecutedStatements = [];
455
472
 
@@ -467,6 +484,7 @@ module.exports = (pDataClonerService, pOratorServiceServer) =>
467
484
  {
468
485
  Table: pTableName,
469
486
  ColumnsAdded: tmpColumnsAdded,
487
+ ColumnsModified: tmpColumnsModified,
470
488
  Statements: tmpExecutedStatements
471
489
  });
472
490
  return fNextTable();
@@ -543,8 +561,18 @@ module.exports = (pDataClonerService, pOratorServiceServer) =>
543
561
  {
544
562
  if (tmpMigrationResults.length > 0)
545
563
  {
546
- let tmpTotalCols = tmpMigrationResults.reduce((pSum, pR) => pSum + pR.ColumnsAdded.length, 0);
547
- tmpFable.log.info(`Data Cloner: Schema migration complete — ${tmpTotalCols} column(s) added across ${tmpMigrationResults.length} table(s).`);
564
+ let tmpTotalAdded = tmpMigrationResults.reduce((pSum, pR) => pSum + pR.ColumnsAdded.length, 0);
565
+ let tmpTotalModified = tmpMigrationResults.reduce((pSum, pR) => pSum + (pR.ColumnsModified ? pR.ColumnsModified.length : 0), 0);
566
+ let tmpSummaryParts = [];
567
+ if (tmpTotalAdded > 0)
568
+ {
569
+ tmpSummaryParts.push(`${tmpTotalAdded} column(s) added`);
570
+ }
571
+ if (tmpTotalModified > 0)
572
+ {
573
+ tmpSummaryParts.push(`${tmpTotalModified} column(s) modified`);
574
+ }
575
+ tmpFable.log.info(`Data Cloner: Schema migration complete — ${tmpSummaryParts.join(', ')} across ${tmpMigrationResults.length} table(s).`);
548
576
  }
549
577
  else
550
578
  {