Skip to content
100% local

SQL schema to TypeORM entity

Turn CREATE TABLE statements into TypeORM entity classes with decorators and relations.

Input

SQL schema to TypeORM entity

Paste one or more SQL CREATE TABLE statements and this tool returns TypeORM entity classes ready to drop into a NestJS or Node.js project — @Entity, @Column, @PrimaryGeneratedColumn and the relation decorators TypeORM expects, generated straight from the schema you already have.

Options control how the classes come out: pick postgres, mysql or sqlite as the target database, since column type names such as uuid, jsonb or tinyint only exist on some of them. Foreign keys become @ManyToOne and @OneToMany pairs, and a pure junction table — two foreign keys and nothing else — collapses into a proper @ManyToMany with @JoinTable. Snake_case columns can be mapped to camelCase properties automatically, with a name option added wherever the two differ, and indexes and unique constraints render as class-level @Index and @Unique decorators. Turn off default values or relation detection when you only want the bare column shape.

The parser understands quoted identifiers, inline and table-level foreign keys, CHECK and COMMENT clauses, and both Unix and Windows line endings, so a schema dump copied from psql, mysqldump or a migration file works as-is. Very large schemas are handled too, though generated code above 10 MB returns a message asking you to shorten the input rather than freezing the tab.

Everything runs in your browser — no schema, table name or column ever leaves your device. Copy the result, download it as a .txt file to split into per-file entities yourself, or send it straight back into the input to keep refining the same schema.

FAQ

Which relations does it detect?
Foreign keys become @ManyToOne/@OneToMany pairs. A table made up of exactly two foreign keys and nothing else is recognized as a join table and becomes a @ManyToMany with @JoinTable instead of its own class.
How are column types chosen?
Each SQL type maps to the closest TypeORM column type for the target database you select — for example uuid stays uuid on PostgreSQL but becomes varchar(36) on MySQL and SQLite, since neither has a native UUID column.
Can I generate one file per entity?
Yes. Turn on "Split into one file per entity" to get a comment header and its own import statement for each class, ready to paste into separate *.entity.ts files.
What happens to composite primary keys?
Each column of a composite primary key gets its own @PrimaryColumn(); auto-increment and UUID generation only apply to a single-column key.
Is my database schema uploaded anywhere?
No. Parsing and code generation run entirely in your browser — the SQL you paste never leaves your device.