Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancment: Mermaid style uses classDiagram, not erDiagram #410

Open
e12e opened this issue Aug 23, 2023 · 0 comments
Open

Enhancment: Mermaid style uses classDiagram, not erDiagram #410

e12e opened this issue Aug 23, 2023 · 0 comments

Comments

@e12e
Copy link

e12e commented Aug 23, 2023

We just looked at an alternative gem that generates Mermaid ER diagrams:rails-mermaid_erd - and noticed it generates far more typical ER diagrams.

The main difference seems to be that rails-erd uses the Mermaid type classDiagram, not erDiagram -- quite possibly this matches better with the old code for dot-diagrams?

At any rate, there seems to be potential to improve Mermaid output considerably, going from:

classDiagram
	direction RL
	class `Course`
	`Course` : +string tag
	`Course` : +string name
	class `CourseType`
	`CourseType` : +string name
	`CourseType` --> `Course`
Loading

to:

erDiagram
  Course {
        integer id PK
        string tag  
        string name  
        integer course_type_id FK
        datetime created_at  
        datetime updated_at  
    }
CourseType {
        integer id PK
        string name  
        datetime created_at  
        datetime updated_at  
    }
Course }o--|| CourseType : "Course of type CourseType"
Loading

erDiagrams are documented at:

https://mermaid.js.org/syntax/entityRelationshipDiagram.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant