Fixing some issues with types being lost when fetching SQL tables, after making changes to tables within Budibase.

This commit is contained in:
mike12345567 2022-04-27 17:11:57 +01:00
parent 0d5eefa727
commit 6d6e83f7c8
1 changed files with 13 additions and 4 deletions

View File

@ -207,11 +207,20 @@ function shouldCopySpecialColumn(
column: { type: string },
fetchedColumn: { type: string } | undefined
) {
const specialTypes = [
FieldTypes.OPTIONS,
FieldTypes.LONGFORM,
FieldTypes.ARRAY,
FieldTypes.FORMULA,
]
if (column && !fetchedColumn) {
return true
}
const fetchedIsNumber =
!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER
return (
column.type === FieldTypes.OPTIONS ||
column.type === FieldTypes.ARRAY ||
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) &&
column.type === FieldTypes.BOOLEAN)
specialTypes.indexOf(column.type) !== -1 ||
(fetchedIsNumber && column.type === FieldTypes.BOOLEAN)
)
}