KarnerTh / mermerd

Create Mermaid-Js ERD diagrams from existing tables
MIT License
460 stars 35 forks source link

Feature: omit non-relation columns #28

Closed Southclaws closed 1 year ago

Southclaws commented 1 year ago

First of all, thanks for building this tool! It's become part of my toolbox for working with large complex relational schemas.

One thing I'd love to see is the ability to filter out all the columns from a table that aren't used as a foreign key. This helps cut down on noise when trying to explain relationships between tables.

I'm happy to open a PR for this if pointed in the right direction 👍

KarnerTh commented 1 year ago

Glad that the tool finds it use :)

That's a perfectly reasonable feature, I'll look into it.

KarnerTh commented 1 year ago

@Southclaws I have one question regarding that feature - just to make sure

If we look at this example

erDiagram
    article {
        integer id PK
        character_varying title 
    }

    article_comment {
        integer id PK
        integer article_id FK
        character_varying comment 
    }

    article_comment }o--|| article : "article_id"

What do you exactly mean by "filter out all the columns from a table that aren't used as a foreign key"?

Should it look like this, because the column article_id of the table article_comment is a foreign key and is therefore "used as a foreign key"

erDiagram
    article {
    }

    article_comment {
        integer article_id FK
    }

    article_comment }o--|| article : "article_id"

or should it look like this, because the column id of the table article is used as a foreign key in the table article_comment

erDiagram
    article {
        integer id PK
    }

    article_comment {
    }

    article_comment }o--|| article : "article_id"
KarnerTh commented 1 year ago

Closing due to inactivity - if it is still needed feel free to reopen with details