SQL to TypeORM Entity Converter

Paste any CREATE TABLE SQL and get TypeORM entity classes with @Entity, @Column, @PrimaryGeneratedColumn, @ManyToOne, @JoinColumn, and @Index decorators.

Runs 100% in your browser. Your input and files never leave your device.

Why use our online SQL to TypeORM Entity Converter?

TypeORM entities are TypeScript classes with decorators. Every column needs a @Column({ type: "...", nullable: ... }) decorator, primary keys need @PrimaryColumn or @PrimaryGeneratedColumn, and every FK needs @ManyToOne + @JoinColumn. Writing this by hand for a 15-table schema is tedious and error-prone.

How to use SQL to TypeORM Entity Converter

  1. 1
    Paste your SQL

    Paste one or more CREATE TABLE statements. Click the TypeORM tab.

  2. 2
    Review the output

    The right panel shows TypeORM entity classes with all column and relation decorators.

  3. 3
    Check the type mapping

    Expand the Type Mapping panel to verify every column — SQL type → TypeORM column type string + TypeScript type.

  4. 4
    Copy or download

    Click Copy to grab entities.ts, or Download ZIP for the full output.

Frequently Asked Questions

How are auto-increment and UUID primary keys handled differently?

Auto-increment integers use @PrimaryGeneratedColumn("increment"), UUID columns use @PrimaryGeneratedColumn("uuid"), and other primary key types use @PrimaryColumn() with the appropriate type.

Is @DeleteDateColumn used for soft deletes?

Yes. When the "Detect timestamps" option is on, a column named deleted_at is decorated with @DeleteDateColumn() instead of @Column(), enabling TypeORM's built-in soft delete support.

What TypeORM version is the output targeting?

TypeORM 0.3.x. The decorator syntax and DataSource pattern are compatible with 0.3.x. If you are on 0.2.x, the import paths differ slightly but the decorator API is the same.

How are composite primary keys handled?

For tables with a composite primary key, each PK column gets @PrimaryColumn() rather than @PrimaryGeneratedColumn(). You can combine this with the TypeORM @Index decorator for multi-column indexes.

Are class-level @Unique and @Index decorators generated?

Yes. Multi-column UNIQUE constraints become @Unique(["col1", "col2"]) class decorators. Standalone CREATE INDEX statements become @Index({ name: "...", columns: [...] }) class decorators.

Also useful: Cron BuilderMermaid Live Editor