A free Drizzle schema generator for existing SQL
Moving an existing database to Drizzle ORM usually means rewriting every table by hand. This Drizzle schema generator reads your CREATE TABLE statements and writes the schema for you: pgTable, mysqlTable or sqliteTable definitions with the right column builders, notNull(), defaults, unique constraints, primary keys and references() for every foreign key.
Indexes and composite keys go into the table's extra configuration, and self-referencing tables get the typed callback Drizzle needs. The output is checked against drizzle-orm, so you can convert SQL to Drizzle and paste the result straight into schema.ts.
Generate a Prisma schema from SQL
Open the Prisma tab for a complete schema.prisma: one model per table with @id, @unique, @default and @map, native types such as @db.VarChar(255) and @db.Timestamptz, enums, @@index and @@unique blocks, and relation fields on both sides of every foreign key. When a table links to another one twice, the relations are named so Prisma can tell them apart.
That makes it a quick Prisma schema generator online for the moment you only have SQL: a migration file, a schema from a tutorial, or a CREATE TABLE you wrote while planning.
PostgreSQL to Drizzle: enums, arrays and identity columns
Postgres enums created with CREATE TYPE … AS ENUM become pgEnum definitions in Drizzle and enum blocks in Prisma, and columns that use them point to the right type. Array columns such as text[] become .array() in Drizzle and String[] in Prisma, and an empty-array default is kept.
SERIAL and BIGSERIAL, GENERATED ALWAYS AS IDENTITY, UUID with gen_random_uuid(), JSONB and timestamp with time zone are all mapped to their Drizzle and Prisma equivalents, including precision.
MySQL to Prisma and Drizzle
Paste a mysqldump file and the MySQL to Prisma schema conversion handles backtick names, AUTO_INCREMENT, unsigned integers, inline ENUM('a','b') columns, tinyint(1) booleans and ON UPDATE CURRENT_TIMESTAMP, which becomes @updatedAt in Prisma and .onUpdateNow() in Drizzle.
KEY and UNIQUE KEY lines become indexes, and CONSTRAINT … FOREIGN KEY lines become relations with their ON DELETE and ON UPDATE actions.
SQLite to Drizzle: booleans, dates and timestamps
SQLite has no real boolean or date types, so Drizzle stores them in other column types. BOOLEAN columns become integer columns in boolean mode, INTEGER PRIMARY KEY AUTOINCREMENT becomes primaryKey({ autoIncrement: true }), and dates stored as TEXT stay text with a CURRENT_TIMESTAMP default, so the schema matches the table you already have.
Generate a schema without connecting to your database
prisma db pull and drizzle-kit pull generate a schema from an existing database, but they need a live connection and credentials. This generator works from SQL text alone: a schema-only dump, a migrations folder, or a single CREATE TABLE. It's useful before the database exists, when you can't reach production, or when you'd rather not hand a tool your connection string.
Statements a schema doesn't need, such as INSERT, SET or CREATE EXTENSION, are skipped. Anything that can't be expressed, like CHECK constraints or views, is listed in the notes so nothing disappears silently.
Prisma 7 schema: where the database URL goes
Prisma 7 no longer accepts url = env("DATABASE_URL") in schema.prisma; the connection URL moves to prisma.config.ts, and the generator uses the new prisma-client provider with an output path. The default output follows that format for PostgreSQL, MySQL and SQLite. Still on Prisma 6? Choose it and the datasource keeps its url line.
From database tables to typed code
Column names like created_at become createdAt in your code while still pointing at the original column, and table names like users become a User model in Prisma. Both options can be switched off if you prefer the database names as they are.
Need TypeScript types for API responses as well? Our JSON to TypeScript and Zod converter does the same for JSON data. If an AI assistant writes your queries, add your ORM and naming rules to a CLAUDE.md or Cursor rules file so new code follows the schema.
Private by design
A schema reveals how your product works, so it shouldn't be pasted into a server you don't control. This generator is plain code running in your browser, with no upload, no AI model and no account, like all of our free developer tools that run in your browser.