Live data from Hacker News

Found a simple tool for database modeling: dbdiagram.io

dbdiagram.io

31–40 of 76 posts

Re: Found a simple tool for database modeling: dbdiagram.io

#31

Earlier quoted context omitted.

I found out about mermaid recently and have been using it to make diagrams. How do you use it for data modeling though?

Did you follow the link that the parent poster posted? It's exactly about how to do data modeling with Mermaid.

I think most people would mean something like using the foreign key constraints information schema views to understand the relationships, print out the columns, etc - its really a pretty trivial SQL query to create mermaid relations (though your engine of choice may not have all the metadata you want) but its actually difficult to find the right level of granularity - its very easy to make a lot of visual noise in mermaid.

Re: Found a simple tool for database modeling: dbdiagram.io

#32
post #5

I have found that ChatGTP and Claude are good at converting a picture of a schema to SQL. So I sketch the schema by hand and the LLM creates the SQL. It can also save the picture as a mermaid text for future edits. Pretty neat.

I had the opposite problem, was given SQL ddl with near 1000 tables and hundreds of constraints, and had to produce the schema map. Ran the ddl and connected it to yEd, and hey presto, schema map!

The truth is that if you are modeling a relationship set of 1000 tables you probably cant usefully show that to someone - you can produce an image but nobody can likely use it.

Instead, consider breaking things down to functional areas and then modeling those - just like how most city thinking is "well get on this main road and then this secondary road will get me to XYZ"

Re: Found a simple tool for database modeling: dbdiagram.io

#33
post #20

Language in that gif reminds me of DOT, from apt install graphviz which is pretty widely used I think. Various tools I use (including some I wrote or worked on) output to DOT format because it's so simple, and from there you tell the tool to make it into the appropriate format for your pdf report or webpage or so: `cat diagram.dot | dot -T png > diagram.png`. The DOT format is not as simple as dbdiagram though! But i…

I think you can also convert it to SVG with the same tool.

Re: Found a simple tool for database modeling: dbdiagram.io

#34
post #15

Mermaid is also great https://docs.mermaidchart.com/blog/posts/7-er-diagram-exampl...

I use it in my project to document the schema. We keep the markdown file in source control so that we update it whenever we make database changes. We also have an extension that allows viewing it as the diagram in vscode in our .vscode\extensions.json file.

There are some disadvantages however:

1. The foreign key relationships aren't completely clear

2. The diagram became difficult to navigate in vscode as our schema grew in size

Re: Found a simple tool for database modeling: dbdiagram.io

#35
I made a database ORM editor too: https://tinspin.itch.io/node

Mine is a desktop Java app. that exports XML that then gets converted to SQL (create.sql)

and ORM Java sources with the matching SQL queries. No reflection, just code generation.

Should work with MySQL (MariaDB), Postgres and Oracle.

Re: Found a simple tool for database modeling: dbdiagram.io

#36

I maintain an almost exhaustive list of text to diagram tools [1]. dbdiagram.io requires login to export. Other dedicated text to database diagram tools are 1. Database Diagram Tool https://databasediagram.com/app 2. QuickDBD https://app.quickdatabasediagrams.com/#/ 3. ERD Lab https://app.erdlab.io/designer/guest (Requires Login to Export) [1]: https://xosh.org/text-to-diagram/

Isn't editable diagram to text more useful?

I used to query databases and create diagrams from the metadata, but text to diagram just makes little sense to me.

Re: Found a simple tool for database modeling: dbdiagram.io

#37
post #35

I made a database ORM editor too: https://tinspin.itch.io/node Mine is a desktop Java app. that exports XML that then gets converted to SQL (create.sql) and ORM Java sources with the matching SQL queries. No reflection, just code generation. Should work with MySQL (MariaDB), Postgres and Oracle.

You're cool!

Re: Found a simple tool for database modeling: dbdiagram.io

#40
post #9
post #8

Earlier quoted context omitted.

"A picture of a schema"? What does this mean? And by SQL do you mean DDL?

> "A picture of a schema"? What does this mean? A hand-drawn picture of a database schema. Something like this: https://www.dreamstime.com/stock-images-database-schema-imag... > And by SQL do you mean DDL? DDL is a subset of SQL, so the distinction is moot.

Huh, weird stuff!

Your linked image shows what appear to be tables, and the little arrows appear to represent entity-relationships between them. But I'm not sure how you'd get useful DDL out of it -- none of the columns have types, no indices, etc.!

Maybe an LLM could sketch out a DDL skeleton from a picture, which someone could use as a starting point?

Post reply on HN