SQL to Prisma / TypeORM Converter

Paste a SQL CREATE TABLE statement and instantly convert it to a Prisma schema model or TypeORM entity. Supports common SQL data types, primary keys, nullable fields, and default values.

Output will appear here...

Why Convert SQL to ORM Schemas?

Object-Relational Mapping (ORM) libraries like Prisma and TypeORM let developers interact with databases using programming language constructs instead of raw SQL. However, many projects start with an existing SQL database, and manually translating CREATE TABLE statements into ORM model definitions is tedious, error-prone, and time-consuming — especially for databases with dozens or hundreds of tables.

Our converter automates this process by parsing your SQL schema and generating properly typed, idiomatic ORM models. It handles common patterns like auto-increment primary keys, nullable vs. required fields, default values, and standard SQL-to-language type mappings.

Supported SQL Types

  • Integers: INT, INTEGER, SMALLINT, BIGINT, SERIAL, BIGSERIAL
  • Floating point: FLOAT, DOUBLE, REAL, DECIMAL, NUMERIC
  • Text: VARCHAR(n), CHAR(n), TEXT, CLOB
  • Boolean: BOOLEAN, BOOL
  • Date/Time: TIMESTAMP, DATETIME, DATE, TIME
  • Binary: BLOB, BYTEA, BINARY
  • JSON: JSON, JSONB

Prisma vs. TypeORM: Which to Choose?

Prisma uses a declarative schema language (.prisma files) with its own type system. It generates a type-safe query client and handles migrations automatically. Prisma is ideal for TypeScript/Node.js projects that value type safety and developer experience.

TypeORM uses TypeScript decorators to define entities as classes. It supports both Active Record and Data Mapper patterns and works with a wide range of databases. TypeORM is a good choice for projects that prefer a more traditional ORM approach or need fine-grained control over queries.

Tip: After converting, review the generated output for relationship fields (foreign keys). Our converter handles individual columns but you may need to manually add @relation (Prisma) or @ManyToOne/@OneToMany (TypeORM) decorators for table relationships.
Disclaimer: Generated schemas are a starting point. Database-specific features (auto-increment, custom types, CHECK constraints, spatial types) may not be fully captured. Generated code is not guaranteed to be production-ready. Always review and test before running migrations.