mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 07:16:00 +00:00
designer useDbRefs WIP
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
allowCreateRefByDrag: false,
|
allowCreateRefByDrag: false,
|
||||||
allowTableAlias: false,
|
allowTableAlias: false,
|
||||||
updateFromDbInfo: true,
|
updateFromDbInfo: true,
|
||||||
|
useDatabaseReferences: true,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
allowCreateRefByDrag: true,
|
allowCreateRefByDrag: true,
|
||||||
allowTableAlias: true,
|
allowTableAlias: true,
|
||||||
updateFromDbInfo: false,
|
updateFromDbInfo: false,
|
||||||
|
useDatabaseReferences: false,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user