Refetch when type changed

This commit is contained in:
Adria Navarro 2024-04-16 16:36:52 +02:00
parent 764235469c
commit e1c092d65d
1 changed files with 11 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import {
} from "@budibase/types"
import { DocumentType, SEPARATOR } from "../db/utils"
import { InvalidColumns, DEFAULT_BB_DATASOURCE_ID } from "../constants"
import { helpers } from "@budibase/shared-core"
import { SWITCHABLE_TYPES, helpers } from "@budibase/shared-core"
import env from "../environment"
import { Knex } from "knex"
@ -348,6 +348,16 @@ function copyExistingPropsOver(
}
const column = existingTableSchema[key]
// If the db column type changed to a non-compatible one, we want to re-fetch it
if (
table.schema[key].type !== existingTableSchema[key].type &&
!SWITCHABLE_TYPES[existingTableSchema[key].type]?.includes(
table.schema[key].type
)
) {
continue
}
if (
column.type === FieldType.LINK &&
!shouldCopyRelationship(column, tableIds)