These docs are a work in progress and may not be fully up to date. Some pages may contain internal notes for our team.
Skip to Content

Data model — CustomFieldDefinition

Defines the schema for custom fields that locations in a workspace can have. One definition per field type per workspace. Actual field values are stored on the Location model, not here.

Table: custom_field_definitions

ColumnTypeNullableDescription
idbigintnoPrimary key
workspace_idbigintnoOwning workspace
namestringnoInternal key (slug-like, used to match location custom_fields)
labelstringnoDisplay label shown in the builder and widget
typestringnoField type enum (see below)
optionsjsonyesAllowed values for constrained types (e.g. dropdown options)
requiredbooleannoWhether the field must be filled in before saving a location
sort_orderintnoDisplay order (managed via reorder endpoint)
created_attimestamp
updated_attimestamp

🔴 [NEEDS CLARIFICATION: Confirm the full type enum from the migration or model cast. Likely values: text, url, phone, email, hours, rating, image.]

Relations

  • belongsTo Workspace — workspace-scoped

Location values

Custom field values are stored in the Location.custom_fields JSON column as { field_name: value }. The name column on this model is the key used to match. If a definition is deleted, the orphaned values remain in location records.

Sort order

sort_order starts at 0 and is maintained by the POST /custom-field-definitions/reorder endpoint, which replaces all sort values atomically. Always include all definitions when calling reorder.