designer useDbRefs WIP

This commit is contained in:
Jan Prochazka
2022-01-06 08:07:09 +01:00
parent 1b551a8665
commit d52e7a3b9f
3 changed files with 24 additions and 0 deletions

View File

@@ -79,9 +79,31 @@
}
}
let references = current?.references;
if (settings?.useDatabaseReferences) {
references = [];
for (const table of newTables) {
for (const fk of table.foreignKeys) {
const dst = newTables.find(x => x.pureName == fk.refTableName && x.schemaName == fk.refSchemaName);
if (!dst) continue;
references.push({
designerId: uuidv1(),
sourceId: table.designerId,
targetId: dst.designerId,
joinType: '',
columns: fk.columns.map(col => ({
source: col.columnName,
target: col.refColumnName,
})),
});
}
}
}
return {
...current,
tables: newTables,
references,
};
}, true);
}