Skip to content

Columns Reference

Each entry in the columns array describes one DB column and how it participates in each generated operation.


Column Object Shape

json
{
  "id":              "uuid-v5-of-column-name",
  "name":            "status_id",
  "type":            "foreignId",
  "relatedModule":   "Statuses",
  "length":          "255",
  "default":         "",
  "unique":          false,
  "nullable":        true,
  "indexed":         true,
  "comment":         "",
  "featureSelections": {
    "backend":  { "create": true, "list": true, "view": true, "edit": true, "delete": false },
    "frontend": { "create": true, "list": true, "view": true, "edit": true, "delete": false }
  }
}
KeyTypeDescription
idstringUUID v5 computed from the column name. Auto-set by introspection.
namestringExact DB column name (snake_case).
typestringNormalized column type — see Column Types below.
relatedModulestringStudlyCase module name for FK columns (e.g. "Statuses"). Empty string for non-FK.
lengthstringColumn length as a string (e.g. "255"). Empty string if not applicable.
defaultstringDefault value as a string, or empty string for none.
uniquebooleanWhether this column has a unique constraint.
nullablebooleanWhether NULL is allowed.
indexedbooleanWhether a plain index exists on this column.
commentstringHuman-readable note (not emitted to DB).
featureSelectionsobjectWhich operations include this column — see below.

Column Types

type valueDB equivalentNotes
stringVARCHAR(255)Default for short text. Use length to override.
textTEXTMedium-length text.
longTextLONGTEXTLarge text / rich content.
integerINT32-bit signed integer.
bigIntegerBIGINT64-bit signed integer.
decimalDECIMAL(8,2)Currency / precision numbers.
booleanTINYINT(1)Checkbox. Rendered as toggle in frontend.
dateDATEDate only (no time).
datetimeDATETIMEDate + time.
jsonJSONJSON column. Not SQLite-safe — avoid in MOBILE_APP.
foreignIdBIGINT UNSIGNEDFK column. Requires relatedModule to be set.
uuidCHAR(36)UUID reference column (not the PK).

SQLite / MOBILE_APP note: Use text instead of json for mobile backend modules. The mobile backend generators substitute TEXT automatically, but specifying text explicitly avoids confusion.


featureSelections Object

Controls whether this column appears in each operation's generated code.

json
"featureSelections": {
  "backend":  { "create": true, "list": true, "view": true, "edit": true, "delete": false },
  "frontend": { "create": true, "list": true, "view": true, "edit": true, "delete": false }
}
OperationBackend effectFrontend effect
listAdded to $fillable, returned in list query resultsShown as a column in the list table
createAdded to validation rules and CreateService assignmentRendered as a form field in CreateForm component
editAdded to validation rules and EditService assignmentRendered as a form field in EditForm component
viewAdded to ViewService eager load + returnDisplayed in the view/details layout
deleteNo effect on backendShown as a confirmation field in DeleteForm

Setting any operation to false suppresses that column entirely from the corresponding generated file.


FK Columns

When type is "foreignId", set relatedModule to the StudlyCase module name:

json
{
  "name": "category_id",
  "type": "foreignId",
  "relatedModule": "Categories",
  "nullable": false
}

The generator will:

  • Emit $table->foreignId('category_id')->constrained('categories') in the migration
  • Add a belongsTo(CategoryModel::class) relationship to the model
  • Render an api-select field (infinite scroll dropdown) in frontend forms
  • Use category?.name as the display path in list tables

Polymorphic (Morph) Columns

Morph pairs are declared on the parent module's morphs array (see module-config.md), not as individual columns. The introspector auto-detects {name}_type + {name}_id pairs and tags them with morph_role.

If you need to manually declare them, add the pair to columns with:

json
[
  { "name": "commentable_type", "type": "string",  "nullable": false },
  { "name": "commentable_id",   "type": "bigInteger", "nullable": false }
]

The generator will emit $table->morphs('commentable') in the migration when a morph pair is detected.


Field Type Mapping (Frontend)

The frontend form field type is inferred from the column type:

Column typefield_type in formComponent rendered
stringinputText input
text, longTexttextareaTextarea
integer, bigInteger, decimalnumber-inputNumeric input
booleancheckboxToggle switch
datedateDate picker
datetimedateDatetime picker
foreignIdapi-selectAsync dropdown
jsontextareaRaw JSON textarea

You can override field_type per-column inside features.frontend.create.fields[].field_type.

Released under the Apache-2.0 License.