fix: fix nested references?

This commit is contained in:
2026-04-15 13:24:51 +08:00
parent 97c8b1966c
commit d5fdb69ad7
3 changed files with 19 additions and 2 deletions
+13 -1
View File
@@ -395,12 +395,24 @@ export function parseCsv(
return config;
});
// Collect all referenced tables
// Collect all referenced tables (including nested references in tuples/arrays)
const references = new Set<string>();
function collectReferences(schema: Schema): void {
if (schema.type === 'reference') {
references.add(schema.tableName);
} else if (schema.type === 'tuple') {
schema.elements.forEach(el => collectReferences(el.schema));
} else if (schema.type === 'array') {
collectReferences(schema.element);
} else if (schema.type === 'union') {
schema.members.forEach(m => collectReferences(m));
}
}
propertyConfigs.forEach(config => {
if (config.isReference && config.referenceTableName) {
references.add(config.referenceTableName);
}
collectReferences(config.schema);
});
const dataRows = records.slice(2);