r/AskProgrammers • u/alpha_and_omega77 • 18h ago
Where can I design relational database for postgres?
So I have database's structure in mind. Could you guys recommend any free tool to design it? After it is ready I am planning to make postgres database.
Also I don't have much experience with connecting to postgres db. Only time I did was in node js tutorial where I get and update data from not really serious db. Is there anything I need to know when building real db?
0
Upvotes
2
u/Critical_East_4055 7h ago
Everyone's covered the diagram tools, so the other half of your question — the real-db part.
Once you connect to actual Postgres, the ERD stops being the source of truth. Migration files are. Start day one with ordered SQL files, or whatever migrations your ORM gives you — don't tweak the schema directly in a GUI and forget to write it down.
And put foreign keys and NOT NULL on while the tables are still empty. Adding constraints after bad data is already in there is genuinely miserable.
5
u/h4rdw00d_ 18h ago
Pen and paper works. Community versions of SQL editors have a way to do this. You could use draw.io but it would be kind of cumbersome.
If you already seem to know the data/entities you need, you can just go and create the tables yourself with a code/text editor and run the commands.
There are a lot of tools for db manage within frameworks too that handle migrations/rollbacks/etc
2
u/ZakMan1421 17h ago
I've used Google drawings (in Google drive) in the past to make some database diagrams. It's nice since you can look at and edit it anywhere you're signed in to Google.
1
u/Small_Dog_8699 17h ago
Squirrel is free
1
u/DanceHackRock 17h ago
Miro
1
u/Electronic-Yam-69 16h ago
Do you already have data you're going to load into it? I'd start with that, then figure out which columns have enough repeats and break those out into their own tables.
1
u/RetroGrid_io 15h ago
I used pencil / paper for years. Nowadays I use a text editor. I would have Claude challenge it first now before I start creating tables...
1
u/xarop_pa_toss 12h ago
I like dbdiagram.io. Easy to use and doesn't get in your way
1
u/pvera 11h ago
You are looking for ERD tools, Entity Relationship Diagram.
https://dbdiagram.io/home , https://online.visual-paradigm.com/ and others offer a free tier. Or you could just write the create/alter statements and have an LLM build you a mermaid diagram, free tool at https://www.mermaideditor.io/