Skip to content

Commit

Permalink
feat: New ScriptObject.skipRecordsComparison property #672
Browse files Browse the repository at this point in the history
  • Loading branch information
hknokh2 committed Mar 12, 2024
1 parent b4778ca commit 826a07a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----
/**
Expand Down
4 changes: 2 additions & 2 deletions src/modules/models/job_models/migrationJobTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/modules/models/script_models/scriptObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default class ScriptObject implements ISfdmuRunScriptObject {
parallelRestJobs: number = 1;

useSourceCSVFile: boolean;
skipRecordsComparison: boolean = false;

@Type(() => ScriptAddonManifestDefinition)
beforeAddons: ScriptAddonManifestDefinition[] = new Array<ScriptAddonManifestDefinition>();
Expand Down Expand Up @@ -144,8 +145,8 @@ export default class ScriptObject implements ISfdmuRunScriptObject {
originalExternalIdIsEmpty: boolean = false;
extraFieldsToUpdate: Array<string> = new Array<string>();



get batchSizes(): {
restBatchSize: number,
bulkV1BatchSize: number
Expand Down

0 comments on commit 826a07a

Please sign in to comment.