ER Diagram

Cardinality is the part people get wrong. Write it explicitly.

ER Diagram: rendered example
Rendered by Gnomon from the source below. No edits.

The source

36 lines of PlantUML, and needs nothing beyond the bundled engine. Copy it, or open the template inside Gnomon and render it as it is.

@startuml

title Entity Relationship Diagram

entity "User" as user {
  * id : INT <<PK>>
  --
  * email : VARCHAR(255)
  * password_hash : VARCHAR(255)
  created_at : TIMESTAMP
}

entity "Post" as post {
  * id : INT <<PK>>
  --
  * user_id : INT <<FK>>
  * title : VARCHAR(255)
  content : TEXT
  published : BOOLEAN
  created_at : TIMESTAMP
}

entity "Comment" as comment {
  * id : INT <<PK>>
  --
  * post_id : INT <<FK>>
  * user_id : INT <<FK>>
  content : TEXT
  created_at : TIMESTAMP
}

user ||--o{ post : writes
user ||--o{ comment : writes
post ||--o{ comment : has

@enduml

Render this offline

This template ships in Gnomon and renders on your machine, with no account and nothing sent to a server. The browser editor is free and needs no install.

Get GnomonOpen the browser editor

Others in UML and standard diagrams