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
| Option | Type | Default | Description |
|---|---|---|---|
name | string | — | Required. The column name. |
type | string | — | Required. See Types below. |
nullable | boolean | true | Whether the column allows null. |
is_primary | boolean | false | Marks the primary key. (primary_key is also accepted as a legacy alias.) |
unique | boolean | false | Enforces a unique constraint on this column alone. |
default | any | — | Default value on insert. Can be a literal (false, 0, "active") or a database expression ("now()", "gen_random_uuid()"). |
hidden | boolean | false | Excludes the column from public API responses. |
ui_type | string | — | Hints which input the content editor renders. Purely presentational — has no effect on the API. |
foreign_key | object | — | See Relationships. |
Types
The following column types are used across Underpeaks's models:
| Type | Description |
|---|---|
string | Text of any length. |
text | Long-form text, rendered as a textarea/rich-text field in the editor. |
int / integer | Whole numbers. |
double / decimal / number | Decimal numbers. |
boolean | True / false. |
datetime / timestamp / timestamp with time zone | Date and time values. |
date | Date only. |
array | A list of values (e.g. tags, image URLs). |
jsonb | Arbitrary structured JSON. |
uuid | A UUID value. |
bigint | Large 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
- Relationships — linking models together with
foreign_key