Using -m mermaid_er one can use the Mermaid ER diagrams.
This functionality is added in this PR similar to the existing mermaid class diagram.
Unfortunately, the mermaid diagrams are not compatible with special characters, colons and spaces in a lot of parts:
https://github.com/mermaid-js/mermaid/issues/1546
Therefore, colons and spaces are replaced with an underscore to increase compatibility and create nice diagrams:
The not null check is currently not supported as well as setting FK for ForeignKeys, as this information is not available in the Column class yet.
Old class diagram
classDiagram
class post_tags{
*INTEGER post_id NOT NULL
*INTEGER tag_id NOT NULL
}
class users{
*INTEGER id NOT NULL
VARCHAR<80> activation_key
DATETIME date_joined
VARCHAR<150> email NOT NULL
BOOLEAN email_alerts
TEXT followers
TEXT following
INTEGER karma
VARCHAR<80> openid
VARCHAR<80> password
BOOLEAN receive_email
INTEGER role
VARCHAR<60> username NOT NULL
}
class posts{
*INTEGER id NOT NULL
INTEGER access
INTEGER author_id NOT NULL
DATETIME date_created
TEXT description
VARCHAR<250> link
INTEGER num_comments
INTEGER score
TEXT tags
VARCHAR<200> title
TEXT votes
}
class comments{
*INTEGER id NOT NULL
INTEGER author_id NOT NULL
TEXT comment
DATETIME date_created
INTEGER parent_id
INTEGER post_id NOT NULL
INTEGER score
TEXT votes
}
class tags{
*INTEGER id NOT NULL
VARCHAR<80> name
VARCHAR<80> slug
}
posts "1" -- "0..n" post_tags
tags "1" -- "0..n" post_tags
users "1" -- "0..n" posts
users "1" -- "0..n" comments
posts "1" -- "0..n" comments
comments "0..1" -- "0..n" comments
New ER Diagram
erDiagram
post_tags {
INTEGER post_id PK
INTEGER tag_id PK
}
users {
INTEGER id PK
VARCHAR(80) activation_key
DATETIME date_joined
VARCHAR(150) email
BOOLEAN email_alerts
TEXT followers
TEXT following
INTEGER karma
VARCHAR(80) openid
VARCHAR(80) password
BOOLEAN receive_email
INTEGER role
VARCHAR(60) username
}
posts {
INTEGER id PK
INTEGER access
INTEGER author_id
DATETIME date_created
TEXT description
VARCHAR(250) link
INTEGER num_comments
INTEGER score
TEXT tags
VARCHAR(200) title
TEXT votes
}
comments {
INTEGER id PK
INTEGER author_id
TEXT comment
DATETIME date_created
INTEGER parent_id
INTEGER post_id
INTEGER score
TEXT votes
}
tags {
INTEGER id PK
VARCHAR(80) name
VARCHAR(80) slug
}
posts 1--0+ post_tags : has
tags 1--0+ post_tags : has
users 1--0+ posts : has
users 1--0+ comments : has
posts 1--0+ comments : has
comments one or zero--0+ comments : has
Using
-m mermaid_er
one can use the Mermaid ER diagrams.This functionality is added in this PR similar to the existing mermaid class diagram. Unfortunately, the mermaid diagrams are not compatible with special characters, colons and spaces in a lot of parts: https://github.com/mermaid-js/mermaid/issues/1546
Therefore, colons and spaces are replaced with an underscore to increase compatibility and create nice diagrams:
The
not null
check is currently not supported as well as settingFK
for ForeignKeys, as this information is not available in the Column class yet.Old class diagram
New ER Diagram
closes #6