Guide

THE TOOLBOX / DATA & ORM UTILITIES

Convert SQL schemas
to Prisma, Drizzle & Mermaid.

Transform PostgreSQL CREATE TABLE definitions into production-ready Prisma models, TypeScript Drizzle ORM tables, and visual Mermaid ER diagrams entirely in your browser.

Sample Schemas
Tables Detected2
Input Size421 B
Prisma Lines22
Drizzle Lines18
Live AST Parser

421 / 20,000 UTF-16 code units · 421 UTF-8 bytes

Live conversion ready (2 tables → Prisma, Drizzle & Mermaid).

Generated ORM & ERD OutputPRISMA

THE DETAILS

AST-based SQL schema conversion, ORM mapping, and ERD visualization.

1. Step-by-Step Workflow

Paste your SQL CREATE TABLE statements or load a sample preset (Blog with Cascade, Store, or Many-to-Many). Click Convert Schema, then switch between the Prisma Schema, Drizzle ORM, and Mermaid ERD tabs to copy or download code.

2. Complete ORM Schema Parity

The AST parser understands complex relational contracts: primary keys, composite primary keys (@@id), UNIQUE constraints, column defaults (numbers, strings, booleans, and now()), and cascading foreign keys (ON DELETE CASCADE / RESTRICT).

3. Instant Architecture Visualization

Visualizing entity relationships before writing migrations prevents architectural bottlenecks. The Mermaid export produces an industry-standard erDiagram showing primary keys (PK), foreign keys (FK), and cardinality links (||--o{) ready for GitHub Markdown or architecture specs.

4. Zero-Data-Egress Security & Related Tools

Enterprise SQL schemas expose internal database architectures, relationship keys, and business models. Conversion runs 100% locally with zero server egress. Need to inspect or generate data? Convert CSV files into SQL in the CSV to SQL Generator, query SQLite databases in the SQLite Database Viewer, or format complex SQL queries in the SQL Formatter.

Data Type & Constraint Mapping Matrix

SQL (PostgreSQL)Prisma SchemaDrizzle ORM (pg-core)Mermaid ERD
INTEGER PRIMARY KEYid Int @idid: integer('id').primaryKey()integer id PK
TEXT NOT NULLtitle Stringtitle: text('title').notNull()text title
BOOLEAN DEFAULT trueactive Boolean? @default(true)active: boolean('active').default(true)boolean active
TIMESTAMP DEFAULT CURRENT_TIMESTAMPcreated_at DateTime? @default(now())created_at: timestamp('created_at').defaultNow()timestamp created_at
REFERENCES parent(id) ON DELETE CASCADE@relation(..., onDelete: Cascade).references(() => parent.id, { onDelete: 'cascade' })parent ||--o{ child
PRIMARY KEY (a, b)@@id([a, b])primaryKey({ columns: [table.a, table.b] })a PK, b PK

Frequently Asked Questions

Does this SQL schema converter transmit my database DDL to a server?

No. All SQL parsing using the node-sql-parser AST engine, schema translation, and code generation execute 100% locally in your browser memory. Your proprietary database schemas and table structures never leave your device.

How are foreign key relationships and cascade actions mapped to Prisma and Drizzle?

Foreign keys with "REFERENCES target(id)" are mapped to bi-directional Prisma @relation declarations with explicit fields, references, and onDelete actions (Cascade, SetNull, Restrict). In Drizzle ORM, they map to .references(() => table_target.id, { onDelete: "cascade" }).

Are composite primary keys and column defaults supported?

Yes. Composite primary keys like "PRIMARY KEY (user_id, role_id)" generate Prisma "@@id([user_id, role_id])" and Drizzle "primaryKey({ columns: [table.user_id, table.role_id] })". Column defaults for booleans, numbers, strings, and "DEFAULT CURRENT_TIMESTAMP" map to @default(...) and .default(...) / .defaultNow().

How do SQL data types map to Prisma and Drizzle ORM types?

INTEGER maps to Prisma Int and Drizzle integer(); REAL maps to Float and real(); TEXT/VARCHAR maps to String and text()/varchar(); BOOLEAN maps to Boolean and boolean(); and TIMESTAMP maps to DateTime and timestamp().

How does the Mermaid ERD generator represent entity relationships?

The engine inspects foreign keys and nullability. A NOT NULL foreign key emits an exact one-to-many relationship ("||--o{"), while a nullable foreign key emits a zero-or-one-to-many relationship ("o|--o{"), generating clean Mermaid erDiagram code.