DocsWorkflowsComponentsAppapp:table:update

app:table:update

Changes the parts a caller names on an existing table

Options

NameTypeDescription
schema_idstringThe name of the schema (database) that contains the table
tablestringThe name of the table to update
table_defTablePatchThe parts of the table to change. What it leaves out is left as it stands, so a workflow that carries only a name renames the table and drops none of its columns
  ↳ namestring
  ↳ descriptionstring
  ↳ fields[]Field
    ↳ namestringIs 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_fromstringNames 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.
    ↳ typeFieldTypeIs the field's data type. See the FieldType constants for the supported values.
    ↳ requiredboolMarks the field as non-nullable / mandatory. Inserts and updates that omit a required field (and provide no Default) are rejected.
    ↳ defaultanyIs 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.
    ↳ computedComputedDeclares 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.
      ↳ fromstringNames 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.
      ↳ usingstringNames the hash algorithm. See the Computed* constants for the set.
    ↳ derived_fromDerivedFromDeclares 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[]stringNames the columns the other row shares with this one, which is what makes the two rows peers.
      ↳ equals[]ParentMatchNames the columns that tell the two rows apart, each pinned to a value read off the record this row belongs to.
        ↳ columnstringNames the column on this table, such as "language".
        ↳ fromstringIs 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.
      ↳ differsComparisonDiffers, 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.
        ↳ minestringIs the column read off the row that carries the derived field.
        ↳ theirsstringIs the column read off the other row.
      ↳ takestringTake, when set, makes this field a copy of the other row's named column.
      ↳ missinganyIs 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_tablestringIs the name of the target table for relation fields. Required when Type is has_one, has_many, or belongs_to; ignored otherwise.
    ↳ related_fieldstringIs 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_deleteboolDeletes 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[]stringIs the ordered list of permitted string values for FieldTypeEnum. Required for enum fields; ignored for all other types.
    ↳ lengthintCaps 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.
    ↳ encryptedboolStores 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.
    ↳ descriptionstringIs a human-readable explanation of the field's purpose. Surfaced in generated documentation and GUI tooling; has no effect on storage or validation.
    ↳ labelstringIs the UI label for the field. Renderers fall back to Name when empty.
    ↳ option_labels[]stringIs 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_sourcestringNames 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_fieldstringNames 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.
  ↳ indexes[]Index
    ↳ namestringIs the index identifier and must be unique within its table.
    ↳ fields[]stringIs the ordered list of field names covered by the index. Order is significant for composite indexes (leftmost-prefix semantics).
    ↳ uniqueboolEnforces that no two records share the same value combination for the indexed fields.
  ↳ versionedbool
  ↳ auditedbool
allow_destructiveboolLets this run execute a plan that drops something, which an explicitly empty field list is. Unset, such a plan is refused and the table keeps its columns

Outputs

NameTypeDescription
tableTableThe updated table definition
  ↳ namestringIs the table identifier and must be unique within a Schema.
  ↳ renamed_fromstringNames the table this one used to be called, so a diff renames the table and keeps its rows instead of creating an empty one beside the old and dropping the old with everything in it. It carries the same rules Field.RenamedFrom does. A declaration whose rename has already been applied converges to no step, and a name that still exists beside the new one, or two tables claiming the same origin, are refused rather than guessed at.
  ↳ descriptionstringIs an optional human-readable summary surfaced in generated documentation and GUI tooling. Has no effect on storage.
  ↳ fields[]FieldIs the ordered list of user-defined columns on the table.
    ↳ namestringIs 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_fromstringNames 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.
    ↳ typeFieldTypeIs the field's data type. See the FieldType constants for the supported values.
    ↳ requiredboolMarks the field as non-nullable / mandatory. Inserts and updates that omit a required field (and provide no Default) are rejected.
    ↳ defaultanyIs 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.
    ↳ computedComputedDeclares 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.
      ↳ fromstringNames 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.
      ↳ usingstringNames the hash algorithm. See the Computed* constants for the set.
    ↳ derived_fromDerivedFromDeclares 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[]stringNames the columns the other row shares with this one, which is what makes the two rows peers.
      ↳ equals[]ParentMatchNames the columns that tell the two rows apart, each pinned to a value read off the record this row belongs to.
        ↳ columnstringNames the column on this table, such as "language".
        ↳ fromstringIs 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.
      ↳ differsComparisonDiffers, 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.
        ↳ minestringIs the column read off the row that carries the derived field.
        ↳ theirsstringIs the column read off the other row.
      ↳ takestringTake, when set, makes this field a copy of the other row's named column.
      ↳ missinganyIs 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_tablestringIs the name of the target table for relation fields. Required when Type is has_one, has_many, or belongs_to; ignored otherwise.
    ↳ related_fieldstringIs 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_deleteboolDeletes 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[]stringIs the ordered list of permitted string values for FieldTypeEnum. Required for enum fields; ignored for all other types.
    ↳ lengthintCaps 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.
    ↳ encryptedboolStores 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.
    ↳ descriptionstringIs a human-readable explanation of the field's purpose. Surfaced in generated documentation and GUI tooling; has no effect on storage or validation.
    ↳ labelstringIs the UI label for the field. Renderers fall back to Name when empty.
    ↳ option_labels[]stringIs 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_sourcestringNames 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_fieldstringNames 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.
  ↳ indexes[]IndexIs the optional list of secondary indexes defined on the table.
    ↳ namestringIs the index identifier and must be unique within its table.
    ↳ fields[]stringIs the ordered list of field names covered by the index. Order is significant for composite indexes (leftmost-prefix semantics).
    ↳ uniqueboolEnforces that no two records share the same value combination for the indexed fields.
  ↳ versionedboolAdds the per-record version counter and version_owner_id columns to this table. The DataStore increments version on every write and stamps version_owner_id with the writing user, supporting optimistic concurrency and "last edited by" semantics
  ↳ auditedboolEnables per-write audit logging for this table. When true, every successful Insert/Update/Delete records an entry in _schema_audit_log with the actor, source, reason, workflow attribution, and a changed-fields diff (before/after for the keys that actually changed). Independent of Versioned: versioning answers "what did the record look like at point X", auditing answers "who changed what, when, why"

Example

name: Update a table
actions:
  - name: updated
    component: app:table:update
    vars:
      schema_id: content
      table: articles
      table_def:
        description: "Blog articles"

outputs:
  table: "{{ updated.table }}"