erDiagram
使いどころ
Use a ER when…
01
Database schema documentation
02
Domain modeling for new features
03
Onboarding for the data layer
構文の基本
The minimal syntax
Copy this and you have a working er. Build from here.
er.mmd
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : appears_in
CUSTOMER {
uuid id PK
string email
datetime created_at
}よく使うパターン
Patterns worth memorizing
Crow's-foot notation
`||--o{` is one-to-many; `}o--o{` is many-to-many. Memorize the four shapes.
Attribute keys
`PK`, `FK`, `UK` after a column type render as small badges.
Relationship verbs
The `: writes` part is the verb on the line; pick a verb that reads in both directions.
ハマりどころ
The things that will trip you up
Mermaid silently ignores misspellings — these are the failures we see most.
- 01
Entity names should be UPPERCASE for cleanest rendering.
- 02
You cannot style individual columns — only the relationship line.
- 03
Long attribute lists make the box tall; consider splitting into linked sub-entities.
関連する図