Why it matters
Schemas live in migration files and dump output, and reading forty CREATE TABLE statements to work out how the tables join is slow. Diagram tools usually want you to redraw the schema by hand or connect them to the database.
This tool reads the DDL itself. It splits the script into statements (respecting quotes, comments and function bodies), reads columns, primary keys, unique constraints and foreign keys wherever they're declared, including ALTER TABLE ... ADD CONSTRAINT lines from pg_dump, and works out each relation's cardinality: a unique foreign key is one-to-one, a nullable one is optional. It then lays the tables out, draws crow's-foot connectors and checks the schema for problems a review would catch: foreign keys with no index on the referencing columns (slow joins and slow deletes on the parent), a foreign key column whose type doesn't match the key it points at, and tables without a primary key. Nothing is sent anywhere.
How it works
- InputCREATE TABLE statements or a schema dump
- In your browserTables, keys and cardinality read from the DDL
- OutputA diagram, schema checks, Mermaid and DBML
Where it fits in a designer's workflow
- Plan
- Design
- Build
- Test
- Launch
By the numbers
Show the numbers as a table
| Table | Columns | Foreign keys |
|---|---|---|
| customers | 4 | 0 |
| addresses | 5 | 1 |
| products | 4 | 0 |
| product_variants | 5 | 1 |
| orders | 5 | 2 |
| order_items | 4 | 2 |
| payments | 4 | 1 |
| reviews | 5 | 2 |
How to use it
- Paste your CREATE TABLE statements, or the output of pg_dump --schema-only, mysqldump -d or sqlite3 .schema.
- Read the diagram; click a table name in the list to centre it.
- Work through the schema checks.
- Download the diagram, or copy the Mermaid or DBML into your docs.
FAQ
Which databases does it understand?
PostgreSQL, MySQL and MariaDB, and SQLite DDL. It detects the dialect from the syntax, such as bigserial, AUTO_INCREMENT or backtick quoting. Statements it doesn't model, like functions, grants and comments, are listed as skipped.
How is one-to-one decided?
A foreign key whose columns are also a primary key or have a UNIQUE constraint can only match one row per parent, so it's drawn one-to-one. A nullable foreign key is drawn as optional.
Why does it want an index on foreign keys?
PostgreSQL doesn't create one automatically. Without it, joins from the child side scan the table, and deleting or updating a parent row has to scan the child table to check the constraint. MySQL InnoDB creates one for you.
Can I use the Mermaid output on GitHub?
Yes. Paste it into a ```mermaid code block in a README or issue and GitHub draws it.
Is my schema uploaded?
No. It's parsed and drawn in your browser.