SQL DDL to TypeORM / Sequelize Models
Converts CREATE TABLE statements into TypeORM entity classes (decorators, ManyToOne and JoinColumn, Index and Unique) or Sequelize model definitions with DataTypes and associations.
Use the tool
Why this tool exists
TypeORM and Sequelize are the usual ORMs in many Node projects, and both need a model per table. When the database already exists, writing them by hand means mapping every column type, nullability, unique constraint and foreign key into decorators or a define call. Paste the DDL and choose the ORM, and this tool writes the classes: columns with the right types, primary keys, indexes, and ManyToOne or belongsTo links for foreign keys. For Prisma, Drizzle, Django, SQLAlchemy and GORM, use the separate converters on this site. The output is a draft for you to review, because relationship naming, lazy loading and cascade behaviour are choices only you can make. It runs in your browser.
How to use it
- Paste your CREATE TABLE statements into the input box.
- Choose TypeORM or Sequelize.
- Copy the generated models, review the relations and connect them to your data source.
Frequently asked questions
What does the TypeORM output include?
Entity classes with Column and PrimaryGeneratedColumn decorators, ManyToOne relations with JoinColumn for foreign keys, and Index and Unique decorators.
What does the Sequelize output include?
Model definitions built with DataTypes, including primary keys, allowNull flags, unique settings and associations for foreign keys, so the generated code reflects the constraints from your CREATE TABLE statements.
Are the reverse relations generated?
The output focuses on the side that holds the foreign key. Add OneToMany or hasMany sides yourself where you need to navigate in both directions.
Which ORMs are covered elsewhere?
Prisma, Drizzle, Django, SQLAlchemy and GORM each have their own dedicated converter on this site, with output tuned to that ORM, so use those if your project is not on TypeORM or Sequelize.