Pages

Topics

Tools

↑↓navigate↵openescclose
Formatting & Data

SQL → TS / Zod / Go

Parse CREATE TABLE statements for PostgreSQL, MySQL and SQLite and generate TypeScript interfaces, Zod schemas, Go structs, Prisma models or Pydantic classes, with camelCase and nullable options.

Runs entirely in your browser — nothing you paste is uploaded.

Target
Presets
397 chars
2 tables10 columnsusersorders

Only CREATE TABLE is read; ALTER TABLE, indexes and INSERT statements are ignored.

live
Generated models
245 chars · 15 lines
export interface User {
  id: number;
  email: string;
  display_name: string | null;
  plan: string;
  created_at: string;
}

export interface Order {
  id: number;
  user_id: number;
  total: number;
  metadata: unknown;
  placed_at: string;
}

A foreign key stays a plain column outside Prisma, where a relation field is needed.

SQL DDL to model cheat sheet

quick reference
CREATE TABLE users (…);
The one statement this tool reads. Column names, types, NOT NULL, DEFAULT and key constraints are all translated into the target model.
serial / bigserial
PostgreSQL auto-increment. It becomes @default(autoincrement()) in Prisma and a plain number in TypeScript, because the database already supplies the value.
timestamptz
Timestamp with time zone. Modelled as an ISO 8601 string in TypeScript and Zod, DateTime in Prisma, and datetime in Pydantic.
numeric(12, 2)
Exact decimal with precision and scale — Decimal in Prisma and Pydantic, float64 in Go and number elsewhere. Never use a float for money in SQL.
REFERENCES users(id)
A foreign key. TypeScript and Go keep it as a plain column; Prisma needs a relation field on both models, so generated Prisma models stay flat.
PRIMARY KEY (a, b)
A composite primary key. Prisma spells it @@id([a, b]) instead of marking one field with @id.

Frequently asked questions

answered below the tool
Which SQL dialects are read?

CREATE TABLE statements from PostgreSQL, MySQL and SQLite, including serial and uuid keys, varchar lengths, numeric precision, arrays and defaults.

Why is a nullable column a union in TypeScript?

TypeScript needs string | null, Prisma marks null with ?, and the nullable option switches between a null union and an optional key.

Does it generate foreign key relations?

It reports the references and keeps the column, but Prisma models stay flat because a Prisma relation needs a field on both models.

All SQL guides