Skip to content

Commit

Permalink
transmogrify petitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Nov 12, 2025
1 parent 0d02d9d commit b4983c7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
32 changes: 31 additions & 1 deletion app/plugins/Transmogrify/config/schema/tables.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@
"__NOTES__": "DATA MIGRATIONS",
"authentication_events": {
"source": "cm_authentication_events",
"displayField": "authenticated_identifier"
"displayField": "authenticated_identifier",
"canSkip": "true"
},
"people": {
"source": "cm_co_people",
Expand Down Expand Up @@ -371,6 +372,7 @@
"notifications": {
"source": "cm_co_notifications",
"displayField": "id",
"canSkip": "true",
"addChangelog": true,
"fieldMap": {
"subject_co_person_id": "subject_person_id",
Expand All @@ -393,6 +395,7 @@
"source": "cm_history_records",
"displayField": "id",
"sqlSelect": "historyRecordsSqlSelect",
"canSkip": "true",
"fieldMap": {
"actor_co_person_id": "actor_person_id",
"co_person_id": "person_id",
Expand Down Expand Up @@ -423,10 +426,37 @@
"source": "cm_co_job_history_records",
"displayField": "id",
"sqlSelect": "jobHistoryRecordsSqlSelect",
"canSkip": "true",
"fieldMap": {
"co_job_id": "job_id",
"co_person_id": "person_id",
"org_identity_id": "external_identity_id"
}
},
"petitions": {
"source": "cm_co_petitions",
"displayField": "authenticated_identifier",
"canSkip": "true",
"fieldMap": {
"co_enrollment_flow_id": null,
"co_id": null,
"cou_id": "cou_id",
"enrollee_org_identity_id": null,
"archived_org_identity_id": null,
"enrollee_co_person_id": "enrollee_person_id",
"enrollee_co_person_role_id": null,
"petitioner_co_person_id": "petitioner_person_id",
"sponsor_co_person_id": null,
"approver_co_person_id": null,
"co_invite_id": null,
"vetting_request_id": null,
"authenticated_identifier": "petitioner_identifier",
"reference_identifier": "enrollee_identifier",
"petitioner_token": "token",
"enrollee_token": null,
"return_url": null,
"approver_comment": null,
"co_petition_id": "petition_id"
}
}
}
19 changes: 13 additions & 6 deletions app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,21 +407,28 @@ public function execute(Arguments $args, ConsoleIo $io): int
// did not load, perhaps because it was associated with an Org Identity
// not linked to a CO Person that was not migrated.
$this->cache['warns'] += 1;
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
$this->cmdPrinter->warning("Skipping $t record " . $row['id'] . " due to invalid foreign key: " . $e->getMessage());
$rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a');
if (isset($row['id'])) {
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
}
$this->cmdPrinter->warning("Skipping $t record " . (string)$rowIdLabel . " due to invalid foreign key: " . $e->getMessage());
$this->cmdPrinter->pause();
}
catch(\InvalidArgumentException $e) {
// If we can't find a value for mapping we skip the record
// (ie: mapLegacyFieldNames basically requires a successful mapping)
$this->cache['warns'] += 1;
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
$this->cmdPrinter->warning("Skipping $t record " . $row['id'] . ": " . $e->getMessage());
$rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a');
if (isset($row['id'])) {
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
}
$this->cmdPrinter->warning("Skipping $t record " . (string)$rowIdLabel . ": " . $e->getMessage());
$this->cmdPrinter->pause();
}
catch(\Exception $e) {
$this->cache['error'] += 1;
$this->cmdPrinter->error("$t record " . $row['id'] . ": " . $e->getMessage());
$rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a');
$this->cmdPrinter->error("$t record " . (string)$rowIdLabel . ": " . $e->getMessage());
$this->cmdPrinter->pause();
}

Expand Down Expand Up @@ -723,4 +730,4 @@ private function skipIfRejectedParent(string $currentTable, array $row): bool

return false;
}
}
}

0 comments on commit b4983c7

Please sign in to comment.