Docs·UnderPeaks

Models & Schema · Field Types

Field Types

Every entry in a model's columns array shares a common set of options, then adds a type.

Column options

OptionTypeDefaultDescription
namestringRequired. The column name.
typestringRequired. See Types below.
nullablebooleantrueWhether the column allows null.
is_primarybooleanfalseMarks the primary key. (primary_key is also accepted as a legacy alias.)
uniquebooleanfalseEnforces a unique constraint on this column alone.
defaultanyDefault value on insert. Can be a literal (false, 0, "active") or a database expression ("now()", "gen_random_uuid()").
hiddenbooleanfalseExcludes the column from public API responses.
ui_typestringHints which input the content editor renders. Purely presentational — has no effect on the API.
foreign_keyobjectSee Relationships.

Types

The following column types are used across Underpeaks's models:

TypeDescription
stringText of any length.
textLong-form text, rendered as a textarea/rich-text field in the editor.
int / integerWhole numbers.
double / decimal / numberDecimal numbers.
booleanTrue / false.
datetime / timestamp / timestamp with time zoneDate and time values.
dateDate only.
arrayA list of values (e.g. tags, image URLs).
jsonbArbitrary structured JSON.
uuidA UUID value.
bigintLarge whole numbers.

ui_type reference

ui_type doesn't change how a value is stored — it only tells the content editor which input to render:

textfield, textarea, rich-text, number-input, currency-input, toggle, select, multi-select, radio, date-picker, datetime-picker, image-upload, tags-input, slug-input, email-input, url-input, phone-input, icon-picker, color-input, code-editor, list.

Example

{
  "name": "discount_percentage",
  "type": "double",
  "nullable": true,
  "default": 0,
  "hidden": false,
  "ui_type": "number-input"
}

Next steps