Why convert SQL to an ORM schema?
You already have a database. It works, it has tables. Now in a new project you want to use an ORM (Object-Relational Mapper) instead of writing raw SQL. But ORMs require you to define the schema in their own format: Prisma uses a `.prisma` file, Drizzle uses TypeScript code with helpers like `pgTable`, TypeORM uses classes with decorators, Sequelize uses `sequelize.define` calls.
You paste `CREATE TABLE` and get a schema in four ORMs: Prisma, Drizzle, TypeORM, Sequelize. The tool recognizes: column types (`VARCHAR(255)` -> String, `INT` -> Int, `TIMESTAMP` -> DateTime), nullability, defaults, primary keys, auto-increment, foreign keys with relations and `ON DELETE CASCADE`.
The output is ready to paste into your project, but treat it as a starting point: every ORM has its own conventions and you may want to tweak a few things by hand.
How to use it
- Paste your `CREATE TABLE` statements into the left panel. Multiple tables with foreign keys are fine.
- Pick the target ORM: Prisma (most popular in the Next.js ecosystem), Drizzle (type-safe, lightweight), TypeORM (classic with decorators), Sequelize (oldest, for Node.js).
- For Drizzle, pick the dialect: PostgreSQL, MySQL, or SQLite. Each uses a different helper (`pgTable`, `mysqlTable`, `sqliteTable`) and different types.
- On the right you get the generated code. Copy with the Copy button and paste into your schema file.
- Review the relations (foreign keys). The tool emits `@relation` in Prisma, `.references()` in Drizzle, `@ManyToOne` in TypeORM. Some relation directions (e.g. the reverse side in Prisma) need to be added by hand.
- A parse errors list appears below if your SQL has non-standard syntax. It will show you the lines the tool skipped.
When this is useful
Classic scenarios:
- Onboarding an existing database into a new project. The company has a 5-year-old PostgreSQL database, you are writing a new Next.js front-end with Prisma. Export CREATE TABLE with `pg_dump --schema-only`, paste here, get an almost-ready `schema.prisma`.
- Migrating from one ORM to another. The old project on TypeORM, the new one on Drizzle. Generate SQL from TypeORM (`typeorm migration:generate`), paste here, get the Drizzle schema.
- Learning differences between ORMs. Paste a simple CREATE TABLE, toggle the target, and watch how the same schema looks in Prisma, Drizzle, TypeORM, and Sequelize. A good way to compare.
- Joining a team that uses a different ORM. You know Sequelize, you join a Prisma project, you want to see how the same schema looks in both.
- Schema code review before a new migration. Check whether the ORM code is consistent with the DDL that lives in the database.
After generating the schema, you may want to format the SQL (for queries). Working with DBML? See the DBML to SQL converter.