mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an error while saving changes to the ERD table. Fixes #5342
This commit is contained in:
committed by
Akshay Joshi
parent
e2b00dda1b
commit
a2a18d4b4a
@@ -305,11 +305,14 @@ export default class ERDCore {
|
||||
let fkTableNode = this.getModel().getNodesDict()[linkData.local_table_uid];
|
||||
|
||||
let newForeingKeys = [];
|
||||
/* Update the FK table with new references */
|
||||
fkTableNode.getData().foreign_key?.forEach((theFkRow)=>{
|
||||
for(let fkColumn of theFkRow.columns) {
|
||||
let attnum = _.find(oldTableData.columns, (c)=>c.name==fkColumn.referenced).attnum;
|
||||
fkColumn.referenced = _.find(tableData.columns, (colm)=>colm.attnum==attnum).name;
|
||||
fkColumn.references_table_name = tableData.name;
|
||||
if(fkColumn.references == tableNode.getID()) {
|
||||
let attnum = _.find(oldTableData.columns, (c)=>c.name==fkColumn.referenced).attnum;
|
||||
fkColumn.referenced = _.find(tableData.columns, (colm)=>colm.attnum==attnum).name;
|
||||
fkColumn.references_table_name = tableData.name;
|
||||
}
|
||||
}
|
||||
newForeingKeys.push(theFkRow);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user