Right-click a table, get a Mermaid ERD — introducing erdMaid

Share

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 Tables node 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 precisiondouble_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/PreferencesPluginsMarketplace, search for erdMaid, and hit Install.

What's out of scope

Worth stating the deliberate omissions:

  • classDiagram is not supported. Faking an ERD with class diagram syntax isn't worth it when proper erDiagram syntax 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.

Read more

Zed에서도 Spring Boot 개발이 됩니다

Zed를 쓰다가 Java/Spring 프로젝트를 열면 늘 같은 벽에 부딪힙니다. 공식 Java 익스텐션 덕분에 Java 자체는 잘 되는데, Spring은 아무것도 모릅니다. application.yml은 그냥 텍스트고, @Value("${...}") 안에서는 자동완성이 안 되고, @Query 안의 JPQL은 오타를 내도 조용합니다. 결국 Spring 작업만 IntelliJ나 VS Code로 넘어가게 됩니다. 그래서 Zed Spring Tools

By algorist

DB 테이블을 우클릭 한 번으로 Mermaid ERD로 — erdMaid 플러그인을 만들었습니다

문서에 넣을 ERD가 필요할 때마다 같은 일을 반복하고 있었습니다. DataGrip에서 테이블 스키마를 열어놓고, 컬럼 이름과 타입을 하나씩 옮겨 적고, FK 관계를 눈으로 따라가며 ||--o{ 를 손으로 그리는 일이요. 테이블이 다섯 개면 참을 만합니다. 마흔 개면 참을 수 없습니다. 그래서 erdMaid 를 만들었습니다. IntelliJ 계열 IDE의 Database 도구 창에서 테이블을 선택하고

By algorist