Skip to main content

Table

A Table is a kind of Type that represents a physical table in a database. Each column in the Table is represented by a Field.

A Table is defined with the !table keyword (in contrast to a regular Type which uses !type) followed by the Table's name. Nested in the Table definition are a list of Field definitions.

Keys#

One key difference between a Table and an ordinary Type is that a Table has more a formal notion of Keys (like in a database).

  • The set of Fields that comprise the Table's Primary Key each have the Tag ~pk.
  • A Field whose Type is a reference to another other Field is implicitly considered a Foreign Key. The expectation is that its value will be equal to an existing value of the referenced Field.
  • A Field whose values must be unique (i.e. a Unique Key) should have the Tag ~unique. If a set of Fields must together have a unique set of values... TODO: Annotation on the !table?

Indexes#

TODO: indexes=[...] Annotation on the !table declaration.

Cascading#

TODO: More Annotations.

See also#