feat(csv-loader): support references in addition to strings for foreignKey reverse ref
This commit is contained in:
parent
9a2db5edb6
commit
5f941aba10
|
|
@ -352,7 +352,14 @@ function resolveReverseReference(
|
|||
currentFilePath,
|
||||
);
|
||||
const pkStr = String(pkValue);
|
||||
return refTable.filter((row) => String(row[schema.foreignKey]) === pkStr);
|
||||
return refTable.filter((row) => {
|
||||
const fkValue = row[schema.foreignKey];
|
||||
const fkStr =
|
||||
fkValue !== null && fkValue !== undefined && typeof fkValue === "object"
|
||||
? String((fkValue as Record<string, unknown>)[defaultPrimaryKey])
|
||||
: String(fkValue);
|
||||
return fkStr === pkStr;
|
||||
});
|
||||
}
|
||||
|
||||
function resolveNestedReferences(
|
||||
|
|
|
|||
Loading…
Reference in New Issue