Remove existing relationships if table changed
This commit is contained in:
parent
db29b131eb
commit
30905d35ef
|
@ -245,12 +245,22 @@
|
||||||
datasource.entities[toTable.name].schema[toRelationship.name] =
|
datasource.entities[toTable.name].schema[toRelationship.name] =
|
||||||
toRelationship
|
toRelationship
|
||||||
|
|
||||||
// If relationship has been renamed
|
// If relationship has been renamed or a different table selected
|
||||||
if (originalFromName !== fromRelationship.name) {
|
if (
|
||||||
delete datasource.entities[fromTable.name].schema[originalFromName]
|
originalFromTable?.name &&
|
||||||
|
(originalFromName !== fromRelationship.name ||
|
||||||
|
hasTableChanged(fromTable, toTable))
|
||||||
|
) {
|
||||||
|
delete datasource.entities[originalFromTable.name].schema[
|
||||||
|
originalFromName
|
||||||
|
]
|
||||||
}
|
}
|
||||||
if (originalToName !== toRelationship.name) {
|
if (
|
||||||
delete datasource.entities[toTable.name].schema[originalToName]
|
originalToTable?.name &&
|
||||||
|
(originalToName !== toRelationship.name ||
|
||||||
|
hasTableChanged(fromTable, toTable))
|
||||||
|
) {
|
||||||
|
delete datasource.entities[originalToTable.name].schema[originalToName]
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the original names so it won't cause an error
|
// store the original names so it won't cause an error
|
||||||
|
|
Loading…
Reference in New Issue