Delete original relationship if table changes
This commit is contained in:
parent
5be6c241b7
commit
db29b131eb
1 changed files with 14 additions and 6 deletions
|
@ -267,13 +267,21 @@
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasTableChanged(fromTbl, toTbl) {
|
||||||
|
const areRelationshipsSet =
|
||||||
|
(originalFromName || originalToName) &&
|
||||||
|
originalFromTable?.name === fromTbl?.name &&
|
||||||
|
originalToTable?.name === toTbl?.name
|
||||||
|
|
||||||
|
return (
|
||||||
|
currentTables?.from?._id !== fromTbl?._id ||
|
||||||
|
currentTables?.to?._id !== toTbl?._id ||
|
||||||
|
!areRelationshipsSet
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function tableChanged(fromTbl, toTbl) {
|
function tableChanged(fromTbl, toTbl) {
|
||||||
if (
|
if (!hasTableChanged(fromTbl, toTbl)) {
|
||||||
(currentTables?.from?._id === fromTbl?._id &&
|
|
||||||
currentTables?.to?._id === toTbl?._id) ||
|
|
||||||
originalFromName ||
|
|
||||||
originalToName
|
|
||||||
) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fromRelationship.name = toTbl?.name || ""
|
fromRelationship.name = toTbl?.name || ""
|
||||||
|
|
Loading…
Reference in a new issue