1
0
Fork 0
mirror of synced 2024-08-23 05:51:29 +12:00

Fix mappings

This commit is contained in:
Adria Navarro 2024-05-06 08:27:21 +02:00
parent fbc969eda4
commit aabed795ec
2 changed files with 9 additions and 1 deletions

View file

@ -108,6 +108,11 @@ export function fixArrayTypes(row: Row, table: Table) {
[FieldType.ARRAY, FieldType.BB_REFERENCE].includes(schema.type) &&
typeof row[fieldName] === "string"
) {
// Handling old single user type
if (schema.constraints?.type !== "array") {
continue
}
try {
row[fieldName] = JSON.parse(row[fieldName])
} catch (err) {

View file

@ -764,7 +764,10 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
field: FieldSchema
): field is JsonFieldMetadata | BBReferenceFieldMetadata {
return (
field.type === FieldType.JSON || field.type === FieldType.BB_REFERENCE
field.type === FieldType.JSON ||
(field.type === FieldType.BB_REFERENCE &&
// Handling old single user type
field.constraints?.type === "array")
)
}