LanguageTables

Tables

A table is a name, an optional description, and its columns between braces.

orders.erdOpen in playground
table orders "Customer orders" {
  id         bigint    pk
  placed_at  datetime
}
The diagram resin draws for orders.erdThe diagram resin draws for orders.erd

Names and descriptions

Table names are unique within a document, external tables included. The description, in double quotes, is for people: it shows next to the name in the diagram and in the side panel, and resin reads nothing into it.

A short table can sit on one line:

table tags { id bigint pk }

resin fmt writes it over three lines, as every other table.

Statements end at the line

A newline ends a statement, so every column sits on a line of its own. Inside parentheses newlines are ignored, which lets a long enum(...) wrap:

payments.erdOpen in playground
table payments {
  id      bigint   pk
  method  varchar  enum(
    CARD,
    BANK_TRANSFER,
  )
}
The diagram resin draws for payments.erdThe diagram resin draws for payments.erd

Comments

%% starts a comment that runs to the end of the line. See Names and comments.

Other kinds of table