← Back to directory

Turn SQL CREATE TABLE statements into a Mermaid erDiagram with columns, PK/FK/UK...

https://code.halowerk.com/v1/ddl-to-erd

Overview

Turn SQL CREATE TABLE statements into a Mermaid erDiagram with columns, PK/FK/UK markers and relationship cardinalities derived from nullability and uniqueness. Parses DDL with node-sql-parser 5.4.0 (PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Snowflake, T-SQL, Redshift grammars): CREATE TABLE with inline and table-level PRIMARY KEY, UNIQUE, REFERENCES and FOREIGN KEY, ALTER TABLE ... ADD [CONSTRAINT] FOREIGN KEY and CREATE UNIQUE INDEX.

Protocol x402 (POST)
Price $0.0030
Payment Asset USD Coin
Payment Network Base
Category uncategorized
Provider code
Source bazaar
Indexed 2026-11-20 13:10:04

Health

Status unknown
Latency (p50) —
Uptime (30d) —
Reliability Score —
Last Checked Never
Last Healthy Never
Consecutive Failures 0

x402 Payment Validation

Payment Requirements —
Asset Verified —
Facilitator —

Input Schema

{ "body": { "ddl": "CREATE TABLE customer (id SERIAL PRIMARY KEY, email VARCHAR(255) NOT NULL UNIQUE);\nCREATE TABLE orders (id BIGINT PRIMARY KEY, customer_id INT NOT NULL REFERENCES customer(id), total NUMERIC(10,2));", "dialect": "postgres" }, "bodyType": "json", "method": "POST", "type": "http" }

Output Schema

{ "example": { "result": { "dialect": "postgres", "mermaid": "erDiagram\n customer {\n serial id PK\n varchar(255) email UK\n }\n orders {\n bigint id PK\n int customer_id FK\n numeric total \"numeric(10,2)\"\n }\n customer ||..o{ orders : \"customer_id\"\n", "relationships": [ { "cardinality": "one-to-many", "child": "orders", "columns": [ "customer_id" ], "constraint": null, "identifying": false, "mermaid": "customer ||..o{ orders : \"customer_id\"", "parent": "customer", "parent_required": true, "references": [ "id" ] } ], "statements_skipped": 0, "tables": [ { "columns": [ { "fk": false, "name": "id", "nullable": false, "pk": true, "type": "serial" }, { "fk": false, "name": "email", "nullable": false, "pk": false, "type": "varchar(255)" } ], "name": "customer", "primary_key": [ "id" ], "unique_keys": [ [ "email" ] ] }, { "columns": [ { "fk": false, "name": "id", "nullable": false, "pk": true, "type": "bigint" }, { "fk": true, "name": "customer_id", "nullable": false, "pk": false, "type": "int" }, { "fk": false, "name": "total", "nullable": true, "pk": false, "type": "numeric(10,2)" } ], "name": "orders", "primary_key": [ "id" ], "unique_keys": [] } ], "verified_by": "mermaid 12.2.0 parser", "warnings": [] }, "service": "ddl-to-erd", "status": "success" }, "type": "json" }