Right-click a table, get a Mermaid ERD — introducing erdMaid
Every time I needed an ERD for a doc, I was doing the same thing. Open the table schema in DataGrip, transcribe column names and types one by one, trace foreign keys by eye, and hand-write ||--o{ for every relationship.
With five tables that's tolerable. With forty it isn't.
So I built erdMaid — an IntelliJ plugin that turns tables selected in the Database tool window into Mermaid erDiagram code, copied straight to your clipboard.
What it does
Expand a schema in the Database tool window and open its Tables node. Select what you want, right-click → Export as Mermaid ERD (erdMaid). That's it.
- Select the
Tablesnode itself to export every table in that schema at once. - Or pick individual tables to export only the slice you care about.
- The result lands on your clipboard with a completion notification. Paste it into Markdown, docs, or any Mermaid-enabled editor.
Sample output
erDiagram
%% Bidding
bidding {
bigint id PK
tinyint automated "auto-quote flag"
varchar(255) status "bidding status"
bigint partner_id
bigint order_id "bidding ID"
bigint amount
datetime created_at
}
bidding_file {
bigint id PK
bigint bidding_id
bigint file_id
datetime created_at
}
%% FK: bidding_file.bidding_id -> bidding.id
bidding ||--o{ bidding_file : ""
What I focused on
The thing I spent the most effort on was output you don't have to hand-fix.
Column order is preserved. erdMaid follows the actual ordinal position from database metadata. No alphabetical re-sorting, no shuffling. The order you see in the DB is the order you get.
Metadata comes along. Primary keys, foreign key relationships, data types, and column comments are all included. Column lines follow type name [PK] ["comment"], and table comments are emitted as %% Mermaid comments.
Everything is normalized so Mermaid doesn't choke. This turned out to be the fiddly part.
- Whitespace in type names becomes
_(double precision→double_precision) - Numeric precision and scale are rendered in a Mermaid-safe form
- Double quotes inside column comments are escaped safely
In other words: paste it and it parses, rather than paste it and start debugging.
Foreign keys stay inside your selection. If you export three tables but the relationship lines reach out to tables you never selected, the diagram breaks. erdMaid only emits relationships where both ends exist within the selected set.
Requirements
- IntelliJ IDEA Ultimate, DataGrip, or another IntelliJ-based IDE with database tooling
- A database connection with table metadata visible in the Database tool window
Installation
erdMaid is available on the JetBrains Marketplace.
👉 erdMaid - Mermaid ERD Export for Database Tables
To install from inside your IDE, go to Settings/Preferences → Plugins → Marketplace, search for erdMaid, and hit Install.
What's out of scope
Worth stating the deliberate omissions:
classDiagramis not supported. Faking an ERD with class diagram syntax isn't worth it when propererDiagramsyntax exists.- Views aren't supported yet. Deprioritized for now.
Closing
If you need ERDs in your docs and you've been transcribing them by hand, this should give that time back.
Bug reports and feature requests are welcome as issues on the GitHub repo.