ERD Generation¶
Generate Entity-Relationship Diagrams from your Django models.
Basic Usage¶
Options¶
| Option | Description | Example |
|---|---|---|
-a APPS |
Filter by specific apps | -a shopping,polls |
-d DIALECT |
Output format | -d mermaid, -d plantuml, -d dbdiagram |
-o OUTPUT |
Output file path | -o erd.md |
Output Formats¶
Mermaid.js¶
Best for: GitHub README files, documentation sites
Output:
erDiagram
Customer {
varchar first_name
varchar last_name
varchar email
}
Order {
ForeignKey customer
datetime order_date
decimal total
}
Customer ||--o{ Order : places
PlantUML¶
Best for: Detailed diagrams, enterprise documentation
Output:
@startuml
entity Customer {
* id : bigint
--
varchar first_name
varchar last_name
varchar email
}
entity Order {
* id : bigint
--
ForeignKey customer
datetime order_date
decimal total
}
Customer ||--o{ Order : places
@enduml
dbdiagram.io¶
Best for: Database design, quick prototyping
Output:
Table Customer {
id bigint [pk]
first_name varchar
last_name varchar
email varchar
}
Table Order {
id bigint [pk]
customer bigint [ref: > Customer.id]
order_date datetime
total decimal
}
Ref: Order.customer > Customer.id
App Filtering¶
Include only specific apps:
Exclude apps by not listing them in the -a parameter.
Integration with Documentation¶
GitHub README¶
-
Generate ERD:
-
Add to README:
```
MkDocs Integration¶
Add to your docs folder and reference in mkdocs.yml:
Tips¶
- Use
-d mermaidfor GitHub-compatible diagrams - Use
-d plantumlfor complex schemas - Use
-d dbdiagramfor database design collaboration - Save output to files for version control
- Regenerate ERDs after model changes