Fixing some issues with types being lost when fetching SQL tables, after making changes to tables within Budibase.
This commit is contained in:
parent
0d5eefa727
commit
6d6e83f7c8
|
@ -207,11 +207,20 @@ function shouldCopySpecialColumn(
|
||||||
column: { type: string },
|
column: { type: string },
|
||||||
fetchedColumn: { type: string } | undefined
|
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 (
|
return (
|
||||||
column.type === FieldTypes.OPTIONS ||
|
specialTypes.indexOf(column.type) !== -1 ||
|
||||||
column.type === FieldTypes.ARRAY ||
|
(fetchedIsNumber && column.type === FieldTypes.BOOLEAN)
|
||||||
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) &&
|
|
||||||
column.type === FieldTypes.BOOLEAN)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue