
Show HN: Dbdot – Golang tool to help generate Postgres schema diagrams - akarki15
https://github.com/akarki15/dbdot
======
maweki
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.

~~~
akarki15
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 :)

------
wongarsu
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/](https://www.jetbrains.com/datagrip/features/)

2:
[https://community.intersystems.com/sites/default/files/inlin...](https://community.intersystems.com/sites/default/files/inline/images/datagrip.png)

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

~~~
akarki15
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.

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

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

------
djrobstep
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.

~~~
kuroguro
There's pgmodeler: [https://pgmodeler.io/](https://pgmodeler.io/)

------
MichaelBosworth
Neat! Thank you.

