mirror of
https://github.com/directus/directus.git
synced 2026-01-23 13:37:58 -05:00
fix: use nullish coalescing operator for setting nullable and defaultValue properties in the getSchema function instead of the ||(or) logical operator which always causes assigning true to the nullable property and ignores 0 and false default values (#5063)
This commit is contained in:
@@ -89,8 +89,8 @@ export async function getSchema(options?: {
|
||||
sortField: collectionMeta?.sort_field || null,
|
||||
fields: mapValues(schemaOverview[collection].columns, (column) => ({
|
||||
field: column.column_name,
|
||||
defaultValue: getDefaultValue(column) || null,
|
||||
nullable: column.is_nullable || true,
|
||||
defaultValue: getDefaultValue(column) ?? null,
|
||||
nullable: column.is_nullable ?? true,
|
||||
type: getLocalType(column) || 'alias',
|
||||
precision: column.numeric_precision || null,
|
||||
scale: column.numeric_scale || null,
|
||||
@@ -121,8 +121,8 @@ export async function getSchema(options?: {
|
||||
|
||||
result.collections[field.collection].fields[field.field] = {
|
||||
field: field.field,
|
||||
defaultValue: existing?.defaultValue || null,
|
||||
nullable: existing?.nullable || true,
|
||||
defaultValue: existing?.defaultValue ?? null,
|
||||
nullable: existing?.nullable ?? true,
|
||||
type: existing
|
||||
? getLocalType(schemaOverview[field.collection].columns[field.field], {
|
||||
special: field.special ? toArray(field.special) : [],
|
||||
|
||||
Reference in New Issue
Block a user