All Free Tools

ERD Generator

Paste CREATE TABLE statements and get an ASCII or Mermaid entity-relationship diagram with detected relationships.

SQL Schema (CREATE TABLE statements)
5 tables detected
ASCII ERD
+────────────────────────────────────────────────────────────────────+
|                               users                                |
+────────────────────────────────────────────────────────────────────+
| id          UUID PRIMARY KEY DEFAULT gen_random_uuid()  [PK]       |
| email       TEXT UNIQUE NOT NULL                        [UQ]       |
| name        TEXT NOT NULL                                          |
| role        TEXT DEFAULT                                [?]        |
| created_at  TIMESTAMPTZ DEFAULT now()                   [?]        |
+────────────────────────────────────────────────────────────────────+

+──────────────────────────────────────────────────────────────────────────────+
|                                    posts                                     |
+──────────────────────────────────────────────────────────────────────────────+
| id          UUID PRIMARY KEY DEFAULT gen_random_uuid()            [PK]       |
| title       TEXT NOT NULL                                                    |
| content     TEXT                                                  [?]        |
| published   BOOLEAN DEFAULT false                                 [?]        |
| author_id   UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE  [FK]       |
| created_at  TIMESTAMPTZ DEFAULT now()                             [?]        |
+──────────────────────────────────────────────────────────────────────────────+

+──────────────────────────────────────────────────────────────────────────────+
|                                   comments                                   |
+──────────────────────────────────────────────────────────────────────────────+
| id          UUID PRIMARY KEY DEFAULT gen_random_uuid()            [PK]       |
| body        TEXT NOT NULL                                                    |
| post_id     UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE  [FK]       |
| user_id     UUID REFERENCES users(id)                             [FK,?]     |
| created_at  TIMESTAMPTZ DEFAULT now()                             [?]        |
+──────────────────────────────────────────────────────────────────────────────+

+────────────────────────────────────────+
|                  tags                  |
+────────────────────────────────────────+
| id    SERIAL PRIMARY KEY    [PK]       |
| name  TEXT UNIQUE NOT NULL  [UQ]       |
+────────────────────────────────────────+

+─────────────────────────────────────────────────────────────────────────────+
|                                  post_tags                                  |
+─────────────────────────────────────────────────────────────────────────────+
| post_id  UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE    [FK]       |
| tag_id   INTEGER NOT NULL REFERENCES tags(id) ON DELETE CASCADE  [FK]       |
+─────────────────────────────────────────────────────────────────────────────+

RELATIONSHIPS:
  posts.author_id ──> users.id
  comments.post_id ──> posts.id
  comments.user_id ──> users.id
  post_tags.post_id ──> posts.id
  post_tags.tag_id ──> tags.id

Database Access

Give Your AI Agents
Database Access. Securely.

Connect any database. Control permissions. Audit every query. All running locally on your machine.