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
5d68be1c63
|
@ -90,6 +90,16 @@
|
|||
if (inSchema(toTable, toRelate.name, originalToName)) {
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue