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.
Only CREATE TABLE is read; ALTER TABLE, indexes and INSERT statements are ignored.
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 toolWhich 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.
Related SQL syntax guides
All SQL guidesPostgres permission denied for sequence: GRANT USAGE and nextval
Sequences carry their own ACL, so table grants never cover nextval. The USAGE grant, default privileges, and why identity columns behave differently.
SQLPostgres RLS 42P17: infinite recursion detected in policy
A policy on members that reads members re-enters itself. One security definer function with a pinned search_path ends the recursion and leaves the rest of the policy intact.
SQLPostgres: could not serialize access due to concurrent update
At REPEATABLE READ and SERIALIZABLE a conflicting write aborts with SQLSTATE 40001. Retry the whole transaction with backoff, then remove the conflict instead of retrying it.
SQLPostgres: cached plan must not change result type
A prepared statement or PL/pgSQL plan outlived a schema change. Disable statement caching, force custom plans, discard plans, and order the deploy so no connection straddles DDL.