Merge pull request #7864 from Budibase/bug/sev4/relationship-column-types-must-match
Do not allow non-matching types for primary/foreign keys - External DB
This commit is contained in:
commit
cdcf6f20d5
|
@ -90,6 +90,16 @@
|
||||||
if (inSchema(toTable, toRelate.name, originalToName)) {
|
if (inSchema(toTable, toRelate.name, originalToName)) {
|
||||||
errObj.toCol = colError
|
errObj.toCol = colError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let fromType, toType
|
||||||
|
if (fromPrimary && fromRelate.fieldName) {
|
||||||
|
fromType = fromTable?.schema[fromPrimary]?.type
|
||||||
|
toType = toTable?.schema[fromRelate.fieldName]?.type
|
||||||
|
}
|
||||||
|
if (fromType && toType && fromType !== toType) {
|
||||||
|
errObj.foreign =
|
||||||
|
"Column type of the foreign key must match the primary key"
|
||||||
|
}
|
||||||
errors = errObj
|
errors = errObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue