From 826a07aaf96727a294c16dccba11811500148cd9 Mon Sep 17 00:00:00 2001 From: hknokh2 Date: Tue, 12 Mar 2024 20:57:23 +0200 Subject: [PATCH] feat: New ScriptObject.skipRecordsComparison property #672 --- .../package/ISfdmuRunCustomAddonScriptObject.ts | 5 ++++- src/modules/models/job_models/migrationJobTask.ts | 4 ++-- src/modules/models/script_models/scriptObject.ts | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/addons/modules/sfdmu-run/custom-addons/package/ISfdmuRunCustomAddonScriptObject.ts b/src/addons/modules/sfdmu-run/custom-addons/package/ISfdmuRunCustomAddonScriptObject.ts index 23f7a4698..39b70f202 100644 --- a/src/addons/modules/sfdmu-run/custom-addons/package/ISfdmuRunCustomAddonScriptObject.ts +++ b/src/addons/modules/sfdmu-run/custom-addons/package/ISfdmuRunCustomAddonScriptObject.ts @@ -44,12 +44,15 @@ export default interface ISfdmuRunCustomAddonScriptObject { parallelBulkJobs?: number; parallelRestJobs?: number; + useSourceCSVFile: boolean; + skipRecordsComparison: boolean; + beforeAddons?: ISfdmuRunCustomAddonScriptAddonManifestDefinition[]; afterAddons?: ISfdmuRunCustomAddonScriptAddonManifestDefinition[]; beforeUpdateAddons?: ISfdmuRunCustomAddonScriptAddonManifestDefinition[]; afterUpdateAddons?: ISfdmuRunCustomAddonScriptAddonManifestDefinition[]; - + filterRecordsAddons?: ISfdmuRunCustomAddonScriptAddonManifestDefinition[]; // ---- Runtime ----- /** diff --git a/src/modules/models/job_models/migrationJobTask.ts b/src/modules/models/job_models/migrationJobTask.ts index 30474498a..e04bd8345 100644 --- a/src/modules/models/job_models/migrationJobTask.ts +++ b/src/modules/models/job_models/migrationJobTask.ts @@ -1260,7 +1260,7 @@ export default class MigrationJobTask { source[CONSTANTS.__IS_PROCESSED_FIELD_NAME] = true; } else if (target && updateMode == "backwards") { // ??? - if (target["Id"] && ___compareRecords(target, cloned, fieldsToCompareRecords)) { + if (target["Id"] && (___compareRecords(target, cloned, fieldsToCompareRecords) || self.scriptObject.skipRecordsComparison)) { cloned["Id"] = target["Id"]; ___removeRecordFields(cloned, notUpdateableFields); processedData.recordsToUpdate.push(cloned); @@ -1276,7 +1276,7 @@ export default class MigrationJobTask { source[CONSTANTS.__IS_PROCESSED_FIELD_NAME] = true; } else if (target && (self.operation == OPERATION.Upsert || self.operation == OPERATION.Update)) { // Updating existing record on the target - if (target["Id"] && ___compareRecords(target, cloned, fieldsToCompareRecords)) { + if (target["Id"] && (___compareRecords(target, cloned, fieldsToCompareRecords) || self.scriptObject.skipRecordsComparison)) { cloned["Id"] = target["Id"]; ___removeRecordFields(cloned, notUpdateableFields); processedData.recordsToUpdate.push(cloned); diff --git a/src/modules/models/script_models/scriptObject.ts b/src/modules/models/script_models/scriptObject.ts index beec20c88..958c125a4 100644 --- a/src/modules/models/script_models/scriptObject.ts +++ b/src/modules/models/script_models/scriptObject.ts @@ -98,6 +98,7 @@ export default class ScriptObject implements ISfdmuRunScriptObject { parallelRestJobs: number = 1; useSourceCSVFile: boolean; + skipRecordsComparison: boolean = false; @Type(() => ScriptAddonManifestDefinition) beforeAddons: ScriptAddonManifestDefinition[] = new Array(); @@ -144,8 +145,8 @@ export default class ScriptObject implements ISfdmuRunScriptObject { originalExternalIdIsEmpty: boolean = false; extraFieldsToUpdate: Array = new Array(); - - + + get batchSizes(): { restBatchSize: number, bulkV1BatchSize: number