Fixed the issue where all FKs are removed if one of the multiple FKs on the same column is removed.

refs #6891
This commit is contained in:
Aditya Toshniwal 2021-10-16 12:57:30 +05:30 committed by Akshay Joshi
parent a908ef7c61
commit c13b1b60e3

View File

@ -342,8 +342,8 @@ export default class ERDCore {
tableData.foreign_key?.forEach((theFkRow)=>{ tableData.foreign_key?.forEach((theFkRow)=>{
let theFk = theFkRow.columns[0]; let theFk = theFkRow.columns[0];
let attnum = _.find(tableNode.getColumns(), (col)=>col.name==theFk.local_column).attnum; let attnum = _.find(tableNode.getColumns(), (col)=>col.name==theFk.local_column).attnum;
/* Skip all those whose attnum matches to the link */ /* Skip all those whose attnum and table matches to the link */
if(linkData.local_column_attnum != attnum) { if(linkData.local_column_attnum != attnum || linkData.referenced_table_uid != theFk.references) {
newForeingKeys.push(theFkRow); newForeingKeys.push(theFkRow);
} }
}); });