Draw a PostgreSQL schema in Mermaid
Generate Mermaid erDiagram syntax from a real 13-table schema, with declared cardinality and primary and foreign key labels.
- target
- Mermaid ER
- access
- Pro export
- source specimen
- 4 of 13 tables · seed/schema.json
Trellis exports a schema drafted on its canvas using PostgreSQL types. This page does not claim to parse a PostgreSQL dump or a live database.
01 / relationship run
The useful unit is the path between entities
This excerpt follows an author to an article, then to its revisions and comments. Entity blocks and matching edge lines come from one exporter run.
account||--o{article||--o{comment
erDiagram
%% Mermaid ER generated from the schema canvas
account {
string id PK
string email
string display_name
string status
string password_hash
string created_at
string updated_at
}
article {
string id PK
string author_id FK
string title
string slug
string body
string[] labels
string search_vector
string published_at
string created_at
string updated_at
}
article_revision {
string article_id FK
number revision
string title
string body
string edited_by FK
string edited_at
}
comment {
string id PK
string article_id FK
string author_id FK
string parent_id FK
string body
string created_at
string deleted_at
}
account ||--o{ article : author_id
article ||--o{ article_revision : article_id
account ||--o{ article_revision : edited_by
article ||--o{ comment : article_id
account ||--o{ comment : author_id
comment ||--o{ comment : parent_id02 / cardinality limit
One documented edge case
All 14 relations in this seed resolve to single-column target keys, so the current Mermaid output emits no caveat line. The source still defines the boundary.
A relation whose target has a composite primary key cannot be represented by this exporter; it is emitted as a Mermaid comment instead.
source / src/lib/exporters/mermaid.ts