DDL to Types
Turn `CREATE TABLE` statements into TypeScript, Zod, Prisma, or Go types.
- Recent results are kept in this browser's local storage until you clear them.
History kept on this device
Recent results are kept in this browser's local storage until you clear them. - Processing happens in this page. No application server receives your input.
Runs in your browser
Processing happens in this page. No application server receives your input.
SQL CREATE TABLE DDL
Generated types
What this tool does
Converts SQL CREATE TABLE statements into TypeScript interfaces, Zod schemas, Prisma models, or Go structs locally in your browser using node-sql-parser. Nullability, primary keys, unique constraints, defaults, and foreign-key comments are preserved across dialects.
In TypeScript, nullable columns are emitted as T | null rather than optional ? properties, because a database row always carries the column key even when its value is NULL. In PostgreSQL, int8 / bigint maps to bigint (avoiding silent truncation above 2^53) and numeric / decimal maps to string (avoiding IEEE-754 floating-point rounding on arbitrary-precision decimals).
Example input: create table users (id serial primary key, email text not null unique, bio text, created_at timestamptz default now());
Limits
DDL only: CREATE TABLE, its columns, and its table-level constraints. Views, triggers, functions, partitions, and ALTER TABLE are ignored rather than half-understood, and ignoring them is reported. Foreign keys become a comment on the field, not a relation: generating a Prisma @relation correctly needs both sides and a back-reference name, and guessing the name produces a schema that does not compile. Custom and domain types fall back to unknown / z.unknown() / Json / any with the warning above.
Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.