Awee

app:table:create

Adds a new table to a schema and applies the migration

Adds a new table to a schema and applies the migration

Options

NameTypeDescription
org_idstringThe organisation ID that owns the schema
schema_idstringThe name of the schema (database) to add the table to
tableTableThe table definition to create
  ↳ namestringIs the table identifier and must be unique within a Schema.
  ↳ descriptionstringIs an optional human-readable summary surfaced in generated documentation and GUI tooling. Has no effect on storage.
  ↳ fieldsFieldIs the ordered list of user-defined columns on the table.
    ↳ namestringIs the column name. Must be unique within the table and must not collide with reserved record fields (id, created_at, updated_at, deleted_at).
    ↳ typeFieldTypeIs the field's data type. See the FieldType constants for the supported values.
    ↳ requiredboolMarks the field as non-nullable. Inserts and updates that omit a required field (and provide no Default) are rejected.
    ↳ defaultanyIs the value applied when a record is inserted without an explicit value for this field. A nil or zero value means no default is applied.
    ↳ 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.
    ↳ descriptionstringIs a human-readable explanation of the field's purpose. Surfaced in generated documentation and GUI tooling; has no effect on storage or validation.
  ↳ indexesIndexIs the optional list of secondary indexes defined on the table.
    ↳ namestringIs the index identifier and must be unique within its table.
    ↳ fieldsstringIs 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.

Outputs

NameTypeDescription
tableTableThe newly created table definition
  ↳ namestringIs the table identifier and must be unique within a Schema.
  ↳ descriptionstringIs an optional human-readable summary surfaced in generated documentation and GUI tooling. Has no effect on storage.
  ↳ fieldsFieldIs the ordered list of user-defined columns on the table.
    ↳ namestringIs the column name. Must be unique within the table and must not collide with reserved record fields (id, created_at, updated_at, deleted_at).
    ↳ typeFieldTypeIs the field's data type. See the FieldType constants for the supported values.
    ↳ requiredboolMarks the field as non-nullable. Inserts and updates that omit a required field (and provide no Default) are rejected.
    ↳ defaultanyIs the value applied when a record is inserted without an explicit value for this field. A nil or zero value means no default is applied.
    ↳ 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.
    ↳ descriptionstringIs a human-readable explanation of the field's purpose. Surfaced in generated documentation and GUI tooling; has no effect on storage or validation.
  ↳ indexesIndexIs the optional list of secondary indexes defined on the table.
    ↳ namestringIs the index identifier and must be unique within its table.
    ↳ fieldsstringIs 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.

How is this guide?

On this page