This commit is contained in:
Mel O'Hagan 2022-09-23 16:54:39 +01:00
parent f492a40edd
commit 9a8b054b19
1 changed files with 7 additions and 10 deletions

View File

@ -90,16 +90,13 @@
if (inSchema(toTable, toRelate.name, originalToName)) { if (inSchema(toTable, toRelate.name, originalToName)) {
errObj.toCol = colError errObj.toCol = colError
} }
if (
fromPrimary && let fromType, toType
fromRelate.fieldName && if (fromPrimary && fromRelate.fieldName) {
plusTables.filter(table => table.name === fromTable?.name)[0]?.schema[ fromType = fromTable?.schema[fromPrimary]?.type
fromPrimary toType = toTable?.schema[fromRelate.fieldName]?.type
]?.type !== }
plusTables.filter(table => table.name === toTable?.name)[0]?.schema[ if (fromType && toType && fromType !== toType) {
fromRelate.fieldName
]?.type
) {
errObj.foreign = errObj.foreign =
"Column type of the foreign key must match the primary key" "Column type of the foreign key must match the primary key"
} }