mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed 'Cannot read properties of undefined' error while creating the table via the ERD tool. Fixes #7275
This commit is contained in:
parent
74c620e478
commit
e6821a610b
@ -35,3 +35,4 @@ Bug fixes
|
|||||||
| `Issue #7265 <https://redmine.postgresql.org/issues/7265>`_ - Fixed schema diff issue in which the option 'null' doesn't appear in the DDL statement for the foreign table.
|
| `Issue #7265 <https://redmine.postgresql.org/issues/7265>`_ - Fixed schema diff issue in which the option 'null' doesn't appear in the DDL statement for the foreign table.
|
||||||
| `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences.
|
| `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences.
|
||||||
| `Issue #7269 <https://redmine.postgresql.org/issues/7269>`_ - Ensure that pgAdmin4 should work with latest jinja2 version.
|
| `Issue #7269 <https://redmine.postgresql.org/issues/7269>`_ - Ensure that pgAdmin4 should work with latest jinja2 version.
|
||||||
|
| `Issue #7275 <https://redmine.postgresql.org/issues/7275>`_ - Fixed 'Cannot read properties of undefined' error while creating the table via the ERD tool.
|
||||||
|
@ -267,11 +267,12 @@ export default class ERDCore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
syncTableLinks(tableNode, oldTableData) {
|
syncColDrop(tableNode, oldTableData) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
if(!oldTableData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let tableData = tableNode.getData();
|
let tableData = tableNode.getData();
|
||||||
const tableNodesDict = this.getModel().getNodesDict();
|
|
||||||
|
|
||||||
/* Remove the links if column dropped or primary key removed */
|
/* Remove the links if column dropped or primary key removed */
|
||||||
_.differenceWith(oldTableData.columns, tableData.columns, function(existing, incoming) {
|
_.differenceWith(oldTableData.columns, tableData.columns, function(existing, incoming) {
|
||||||
if(existing.attnum == incoming.attnum && existing.is_primary_key && !incoming.is_primary_key) {
|
if(existing.attnum == incoming.attnum && existing.is_primary_key && !incoming.is_primary_key) {
|
||||||
@ -287,7 +288,13 @@ export default class ERDCore {
|
|||||||
}
|
}
|
||||||
tableNode.removePort(existPort);
|
tableNode.removePort(existPort);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
syncFkRefNames(tableNode, oldTableData) {
|
||||||
|
if(!oldTableData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let tableData = tableNode.getData();
|
||||||
/* Sync the name changes in references FK */
|
/* Sync the name changes in references FK */
|
||||||
Object.values(tableNode.getPorts()).forEach((port)=>{
|
Object.values(tableNode.getPorts()).forEach((port)=>{
|
||||||
if(port.getSubtype() != 'one') {
|
if(port.getSubtype() != 'one') {
|
||||||
@ -312,9 +319,17 @@ export default class ERDCore {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
syncTableLinks(tableNode, oldTableData) {
|
||||||
|
if(oldTableData) {
|
||||||
|
this.syncColDrop(tableNode, oldTableData);
|
||||||
|
this.syncFkRefNames(tableNode, oldTableData);
|
||||||
|
}
|
||||||
/* Sync the changed/removed/added foreign keys */
|
/* Sync the changed/removed/added foreign keys */
|
||||||
tableData = tableNode.getData();
|
let tableData = tableNode.getData();
|
||||||
|
let tableNodesDict = this.getModel().getNodesDict();
|
||||||
|
|
||||||
const addLink = (theFk)=>{
|
const addLink = (theFk)=>{
|
||||||
if(!theFk) return;
|
if(!theFk) return;
|
||||||
let newData = {
|
let newData = {
|
||||||
|
Loading…
Reference in New Issue
Block a user