field | Field | The updated field definition |
↳ name | string | Is the column / input name. Must be unique within its table or input set and must not collide with reserved record fields (id, created_at, updated_at, deleted_at, version, version_owner_id) when used as a DB column. |
↳ renamed_from | string | Names the column this field used to be called, so a diff moves the column and the values in it instead of dropping one name and adding another empty one. It is an instruction rather than a property. Nothing stores it, nothing renders it, and a declaration carrying one that has already been applied converges to no step at all, so it can be left in a declaration for as long as its author finds it useful. What it cannot be is ambiguous. A name that still exists beside the new one, or two fields claiming the same origin, are both refused rather than guessed at. |
↳ type | FieldType | Is the field's data type. See the FieldType constants for the supported values. |
↳ required | bool | Marks the field as non-nullable / mandatory. Inserts and updates that omit a required field (and provide no Default) are rejected. |
↳ default | any | Is the value applied when a record is inserted (or a form is rendered) without an explicit value for this field. A nil or zero value means no default is applied. |
↳ computed | Computed | Declares that the engine fills this field from another field on the same row rather than from anything a writer sends. A field that sets it may not also carry Default or DefaultSource, since two things would be filling it. See Computed for the rules and for when the value is recomputed. |
↳ from | string | Names another field on the same table, the one whose value is hashed. It may not name the computed field itself, a relation, or another computed field, so the value always resolves in a single step. |
↳ using | string | Names the hash algorithm. See the Computed* constants for the set. |
↳ derived_from | DerivedFrom | Declares that this field's value is settled from another row of the same table rather than from the row it sits on. The engine owns the field, so a value a writer sends for it is dropped. See DerivedFrom for how the other row is found and when the value is settled again. |
↳ same_as | []string | Names the columns the other row shares with this one, which is what makes the two rows peers. |
↳ equals | []ParentMatch | Names the columns that tell the two rows apart, each pinned to a value read off the record this row belongs to. |
↳ column | string | Names the column on this table, such as "language". |
↳ from | string | Is a dotted path through one belongs_to field of this table, such as "project_id.language". Exactly one hop, so the value always resolves in a single read. |
↳ differs | Comparison | Differs, when set, makes this field true while Mine differs from Theirs. The field carrying it has to be a bool, since that is the only answer a comparison has. |
↳ mine | string | Is the column read off the row that carries the derived field. |
↳ theirs | string | Is the column read off the other row. |
↳ take | string | Take, when set, makes this field a copy of the other row's named column. |
↳ missing | any | Is the value the field takes while no such row exists. It is also what a comparison answers when this row's own side of it holds nothing, since a value nobody recorded is not a value that differs from anything. |
↳ related_table | string | Is the name of the target table for relation fields. Required when Type is has_one, has_many, or belongs_to; ignored otherwise. |
↳ related_field | string | Is the name of the foreign-key field on the related table. Used only by has_many to identify which column on RelatedTable points back to this record. |
↳ cascade_delete | bool | Deletes the rows this relation names when the row carrying it is deleted. Only a has_many field may set it, since it is the row on this side that owns the rows on the other, and a belongs_to points the other way. A delete is soft, so a cascade tombstones the rows rather than removing them, and the whole tree is deleted under one correlation id, which is what an undo of the operation walks back in a single call. |
↳ options | []string | Is the ordered list of permitted string values for FieldTypeEnum. Required for enum fields; ignored for all other types. |
↳ length | int | Caps how many characters the column holds, for the types a storage backend declares as a variable-length string. Zero picks the backend's default width for the type, so a field that never sets it keeps the column it has always had. Only string-backed types accept a length, and relation columns are excluded even though they are strings, because they hold ids the engine generates. See HasConfigurableLength for the set and DefaultLength for the widths. |
↳ encrypted | bool | Stores the field's value as ciphertext, so a database dump hands out a blob rather than the value. It is orthogonal to Type, which keeps describing what a reader and a writer exchange, and only the types CanEncrypt admits may set it. A sealed column is opaque to the database, which is what the flag costs. The value cannot be filtered on, sorted by, searched, indexed, made unique, or pointed at by a relation, because the cipher is randomized and two equal plaintexts seal to two different blobs. See ValidateEncryption for the declarations this rules out. |
↳ description | string | Is a human-readable explanation of the field's purpose. Surfaced in generated documentation and GUI tooling; has no effect on storage or validation. |
↳ label | string | Is the UI label for the field. Renderers fall back to Name when empty. |
↳ option_labels | []string | Is a parallel array to Options that carries display labels for enum values. Index i in OptionLabels labels Options[i]. When empty, the value itself is shown. |
↳ default_source | string | Names where a field's default comes from when it is read off a clock rather than declared as a literal. The allowed sources are "now" and "today". The set is closed and intentionally excludes identity sources (org_id, user_id), which are injected as workflow vars by the server, never surfaced as form fields. A record inserted without the field is filled from the source at the moment of the write, in the spelling the field's type stores, and a form prefills the same value. A literal Default still wins over it. Only the types that can hold the value accept a source, see AcceptsDefaultSource. It is stored beside the column rather than in it, because the value is decided per write and never by the database. |
↳ relation_label_field | string | Names the field on the related record that the UI should show as the dropdown label. When empty, the renderer falls back to the related record's id. Only meaningful when Type is a relation. |