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 { return {
...current, ...current,
tables: newTables, tables: newTables,
references,
}; };
}, true); }, true);
} }

View File

@@ -10,5 +10,6 @@
allowCreateRefByDrag: false, allowCreateRefByDrag: false,
allowTableAlias: false, allowTableAlias: false,
updateFromDbInfo: true, updateFromDbInfo: true,
useDatabaseReferences: true,
}} }}
/> />

View File

@@ -10,5 +10,6 @@
allowCreateRefByDrag: true, allowCreateRefByDrag: true,
allowTableAlias: true, allowTableAlias: true,
updateFromDbInfo: false, updateFromDbInfo: false,
useDatabaseReferences: false,
}} }}
/> />