Declare a database table with typed fields and constraints.
| Kind | Keyword |
| Since | 0.1.0 |
| Repeatable | yes |
model <name>
| Name | Type | Required |
|---|---|---|
name |
identifier |
yes |
A model declares a persistent entity backed by a SQL table. The runtime auto-migrates the schema: adding fields, indexes, and unique constraints triggers ALTER TABLE on next start. Field declarations use name: <type> [constraint...]. Built-in types include text, email, int, float, bool, timestamp, date, uuid, password, image, file, json, reference <model>, option [a, b, c], tags, and others.
model user
email: email required unique
name: text required
role: option [admin, editor, viewer] default "viewer"
age: int min 18 max 120
created_at: timestamp auto
model invoice
tenant: account
amount: decimal required
status: option [draft, sent, paid] default "draft"
index (tenant, status)
⚠ Implementation touched after spec. Source code changed on
2026-05-20, but this entity's spec was last edited on2026-05-08. The description may be out of date.
| Spec last touched | 5da8498 (2026-05-08) |
| Source last touched | af278bb (2026-05-20) |
| Source files | internal/parser/parser.go |