Field builder

The --fields string has a compact syntax with a few rules that are easy to forget: a relationship names its model, a vector needs its dimension, and choices go in brackets. Build it here instead.

Start from:

Singular and PascalCase. The generator produces the plural table, route and type names itself.

Modifiers for number

A single line

Modifiers for customer

This row points at one other

Modifiers for total

Minor units and a currency

Modifiers for status

One of a list

Modifiers for due_at
Modifiers for notes

Several lines

The syntax, if you would rather type it

A field is name:type, with optional extras after it, and fields are separated by commas.

  • title:string:required adds a modifier. The modifiers are required, unique and optional.
  • author:belongs_to:User names the related model in the third position. That is not a modifier, so modifiers come after it.
  • status:select[draft, sent, paid] lists the choices. Write draft=Draft in progress when the label is not just the value capitalised.
  • embedding:vector[1536] gives the dimension, which is part of the column type rather than a setting.
  • photo:file:image restricts what may be uploaded.
  • slug:slug:title says which field the slug is built from.
  • notes:text if status == disputed shows the field only when another field has a value. The same thing can be written notes:text:when=status=disputed.

The full list of types, with what each one produces across the stack, is in the field types reference.