Skip to content

Enhancment: Mermaid style uses classDiagram, not erDiagram #410

@e12e

Description

@e12e

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions