1
0
Fork 0
mirror of synced 2024-09-12 23:43:09 +12:00

Making sure all JSON column types are correctly handled.

This commit is contained in:
mike12345567 2024-05-23 15:00:13 +01:00
parent 0c28d05d40
commit 66686fd970
2 changed files with 12 additions and 3 deletions

View file

@ -20,6 +20,7 @@ import {
INTERNAL_TABLE_SOURCE_ID, INTERNAL_TABLE_SOURCE_ID,
SqlClient, SqlClient,
QueryOptions, QueryOptions,
JsonTypes,
} from "@budibase/types" } from "@budibase/types"
import environment from "../environment" import environment from "../environment"
import { helpers } from "@budibase/shared-core" import { helpers } from "@budibase/shared-core"
@ -796,9 +797,8 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
field: FieldSchema field: FieldSchema
): field is JsonFieldMetadata | BBReferenceFieldMetadata { ): field is JsonFieldMetadata | BBReferenceFieldMetadata {
return ( return (
field.type === FieldType.JSON || JsonTypes.includes(field.type) &&
(field.type === FieldType.BB_REFERENCE && !helpers.schema.isDeprecatedSingleUserColumn(field)
!helpers.schema.isDeprecatedSingleUserColumn(field))
) )
} }

View file

@ -118,6 +118,15 @@ export enum FieldType {
BB_REFERENCE_SINGLE = "bb_reference_single", BB_REFERENCE_SINGLE = "bb_reference_single",
} }
export const JsonTypes = [
FieldType.ATTACHMENT_SINGLE,
FieldType.BB_REFERENCE_SINGLE,
FieldType.ATTACHMENTS,
FieldType.BB_REFERENCE,
FieldType.JSON,
FieldType.ARRAY,
]
export interface RowAttachment { export interface RowAttachment {
size: number size: number
name: string name: string