Do not allow non-match type primary foreign keys
This commit is contained in:
parent
f62888d0f8
commit
9cc931acc4
|
@ -90,6 +90,19 @@
|
||||||
if (inSchema(toTable, toRelate.name, originalToName)) {
|
if (inSchema(toTable, toRelate.name, originalToName)) {
|
||||||
errObj.toCol = colError
|
errObj.toCol = colError
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
fromPrimary &&
|
||||||
|
fromRelate.fieldName &&
|
||||||
|
plusTables.filter(table => table.name === fromTable?.name)[0]?.schema[
|
||||||
|
fromPrimary
|
||||||
|
]?.type !==
|
||||||
|
plusTables.filter(table => table.name === toTable?.name)[0]?.schema[
|
||||||
|
fromRelate.fieldName
|
||||||
|
]?.type
|
||||||
|
) {
|
||||||
|
errObj.foreign =
|
||||||
|
"Column type of the foreign key must match the primary key"
|
||||||
|
}
|
||||||
errors = errObj
|
errors = errObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue