The erDiagram text form (spec/02 §11.3, spec/13 §7.3): an entity–relationship diagram
written as mermaid writes one, read into a layered diagram's design
(Macaw.Frame.TextForms) whose edges end in crow's feet.
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
CUSTOMER {
string name PK
string email UK
}- A relationship is
A <left><line><right> B : label: the line--(identifying,solid) or..(dashed); the left cardinality atA,||(one),|o(zero_or_one),}|(one_or_many) or}o(zero_or_many); the right atB,||,o|,|{oro{alike. Its label is required, quoted or not. - An entity is named by a relationship, alone on a line, or by a block
NAME {with an attribute a line,type name [key], until}; a key isPK,FKorUK, or several joined by commas.
Rows: nodes (id, label the name and its attributes a line each, shape rect)
in order of first appearance; edges (source, target, label, head the right
cardinality, tail the left, line) in order; attributes (entity, name, type,
key) in entity order. Faults, every one at once: {:expected, :relationship},
{:expected, :label}, {:expected, :attribute}, {:unclosed, "entity"},
{:unexpected, "}"}. print/1 writes the entities, then the relationships.