SQL to Visual ERD, Drizzle & Prisma Converter

Reverse-engineer any CREATE TABLE DDL script into draggable tables and convert cleanly to Drizzle ORM, Prisma, or TypeScript in one click.

Templates:
customers4 cols
id
uuid
email
varchar
full_name
varchar
created_at
timestamp
products5 cols
id
uuid
sku
varchar
title
varchar
price
decimal
stock
int
orders5 cols
id
uuid
customer_id
uuid
status
varchar
total
decimal
created_at
timestamp
order_items5 cols
id
serial
order_id
uuid
product_id
uuid
quantity
int
unit_price
decimal
Drag tables to arrange your ERD · Click any table to edit columns & relations
// Generated by SchemaCost — Drizzle ORM (PostgreSQL)
import { pgTable, uuid, varchar, timestamp, numeric, integer, bigserial } from 'drizzle-orm/pg-core';

export const customers = pgTable('customers', {
  id: uuid('id').primaryKey().defaultRandom(),
  email: varchar('email', { length: 255 }).notNull().unique(),
  fullName: varchar('full_name', { length: 255 }).notNull(),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
});

export const products = pgTable('products', {
  id: uuid('id').primaryKey().defaultRandom(),
  sku: varchar('sku', { length: 255 }).notNull().unique(),
  title: varchar('title', { length: 255 }).notNull(),
  price: numeric('price', { precision: 12, scale: 2 }).notNull(),
  stock: integer('stock').notNull(),
});

export const orders = pgTable('orders', {
  id: uuid('id').primaryKey().defaultRandom(),
  customerId: uuid('customer_id').notNull().references(() => customers.id, { onDelete: 'restrict' }),
  status: varchar('status', { length: 255 }).notNull(),
  total: numeric('total', { precision: 12, scale: 2 }).notNull(),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
});

export const orderItems = pgTable('order_items', {
  id: bigserial('id', { mode: 'number' }).primaryKey(),
  orderId: uuid('order_id').notNull().references(() => orders.id, { onDelete: 'cascade' }),
  productId: uuid('product_id').notNull().references(() => products.id, { onDelete: 'restrict' }),
  quantity: integer('quantity').notNull(),
  unitPrice: numeric('unit_price', { precision: 12, scale: 2 }).notNull(),
});

Key Highlights

  • ✓ 100% browser-local parsing — proprietary schemas never leave your machine.
  • ✓ Preserves primary keys, NOT NULL, UNIQUE constraints, and foreign key relations.

Frequently Asked Questions

Is my SQL schema uploaded to a server?

Never. Parsing, diagram rendering, code generation, and .ZIP packaging all run 100% locally in your browser.