Skip to content
migration.tools
SQL DDL to TypeScript

SQL to TypeScript converter

Get row types for your database without wiring up a code generator. Each table becomes an interface, nullable columns become T | null, and ENUM columns become unions of string literals.

Options
Most drivers return strings over JSON and Date objects in process.

CREATE TABLE statements

TypeScript

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Paste your SQL DDL or drop a file onto the input panel.
  2. 2Adjust the options — the result updates as you type.
  3. 3Copy the TypeScript or download it. Drop several files to convert a batch into one ZIP.

Type choices worth knowing

DECIMAL and NUMERIC columns are typed as string, because that is what database drivers return to avoid floating-point loss. BIGINT is typed as number with a comment, since it can exceed JavaScript's safe integer range — switch it to bigint or string if your driver does.

JSON columns are typed as unknown rather than any, so you are prompted to validate or narrow them where they are used.

Questions

Does it need a database connection?

No. It reads the DDL you paste, so it works with a dump, a migration file or a schema you are still designing.