ER diagrams
erDiagram draws entities and the cardinality between them. The mark is a crow's foot, not an arrow. || is exactly
one, |o is zero or one, }| is one or more, }o is zero or more. The right-hand mark is the mirror (o|, |{,
o{). .. draws the same feet on a dashed line.
MermoidAscent.svgDiagram(Mermaid("""erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
""".stripMargin))Attributes
An entity block lists attributes as type name, with PK and FK when the attribute is a key. A quoted string after
the name is a comment and stays on the attribute. classDef and style paint the entity the same way they paint a
flowchart node.
MermoidAscent.svgDiagram(Mermaid("""erDiagram
CUSTOMER ||--o{ ORDER : places
CUSTOMER {
string name PK
string sector
}
ORDER {
int orderNumber PK
string deliveryAddress FK
}
""".stripMargin))