Settings

Theme

Show HN: Dbdot – Golang tool to help generate Postgres schema diagrams

github.com

119 points by akarki15 7 years ago · 12 comments

Reader

maweki 7 years ago

The diagrams in that way are problematic. When you model them as digraphs and use this layout and order them from too to bottom you get all the tables at the top that represent n:m relationships and at the bottom (at different levels) your main/independent entities.

At least bottom to top would pack the independent ones to the top and those that represent many-to-many relationships at the bottom.

From my work with Oracle Datamodeler know that even at a dozen tables manual layout beats an algorithm any time. And the oracle algithms are more sophisticated/less general than dot.

  • akarki15OP 7 years ago

    That's a valid concern. My inspiration for writing this tool was to create schema diagrams for select tables (hence the -whitelist flag in the tool) rather than _all_ the tables. Think design review, presentation etc instead of exploring a new db. Having some way to dictate what table would be at the top vs. bottom would be nice.

    My only fear with that is dbdot becomes bloated with flags and features. If customization of dot can be achieved by piping dbdot output to some other tool, I will explore that path.

    Thank you for your feedback :)

  • stubish 7 years ago

    Anyone know of any tools that let you manually layout the elements in a dotfile such as generated by dbdot or similar tools?

  • mistrial9 7 years ago

    .. not a giant fan of AI but, this sounds like exactly the sort of thing an AI could be taught to do ..

wongarsu 7 years ago

The best tool I've found for generating Postgres schema diagrams is Datagrip's diagram feature [2]. It's not without flaws and doesn't seem to get much love, but it also does a lot of things right: tables are arranged in a tree like fashion, where the most referenced tables end up on top. Right angled connectors look orderly even when 10 different tables reference one table (if we ignore the labels on the connectors). The color scheme is also quite nice if you leave datagrip in dark mode.

1: https://www.jetbrains.com/datagrip/features/

2: https://community.intersystems.com/sites/default/files/inlin...

nathancahill 7 years ago

For high-level/quick-and-dirty designing I'm a fan of https://dbdiagram.io/

  • akarki15OP 7 years ago

    That's a cool website. I would say my usecase is really focused on picking existing n tables in a db for like a design or presentation. I would not want to handcraft tables as I don't care what the diagram looks like; all I care is that the diagram accurately reflects the schema.

    I intend to stick true to my inspiration and keep dbdot focused for that usecase. Hence, I expect this tool to actually reach a completion after which I don't think I will want to add any more features.

  • maweki 7 years ago

    That's not high level design though. High level would be (for example) in Barker-notation were you have subclasses and n:m relationships are not represented as their own entities.

    Only as a next step you translate that to the actual relations.

mmsimanga 7 years ago

I have had great success with Schema Spy[0]. It documents your database and includes a schema diagram.

[0]https://github.com/schemaspy/schemaspy

djrobstep 7 years ago

Good schema design tools are the missing piece for making PostgreSQL the complete package.

Ideally there'd be an officially supported tool that allowed you to define your relationships at a high level and it would create a well normalised and indexed schema for you automatically.

MichaelBosworth 7 years ago

Neat! Thank you.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection