SQL to Drizzle ORM Schema

TypeScript ORM

Convert SQL CREATE TABLE DDL migrations into strongly typed Drizzle ORM pgTable, mysqlTable, or sqliteTable schemas.

SQL DDL (CREATE TABLE)
SQL DDL SQL
schema.ts
0 tables Drizzle TS

About This Tool

Migrating existing SQL schemas or database dumps into Drizzle ORM requires mapping SQL column types, nullability constraints, default expressions, and foreign-key references into TypeScript builder chains.

This tool parses SQL CREATE TABLE statements entirely in your browser and emits ready-to-use Drizzle ORM table declarations along with exact tree-shakeable imports from drizzle-orm/pg-core, mysql-core, or sqlite-core.

Key Features

  • Multi-Table DDL Parsing: Handles multiple CREATE TABLE statements, composite primary keys, inline REFERENCES clauses, and SQL comments.
  • Dialect-Accurate Column Builders: Maps UUID, SERIAL, VARCHAR(n), TIMESTAMPTZ, JSONB, and BOOLEAN to their exact Drizzle column functions.
  • Automatic Type Inference Exports: Generates $inferSelect and $inferInsert TypeScript types for every table.

Frequently Asked Questions

Which SQL dialects and Drizzle packages are supported?
PostgreSQL (drizzle-orm/pg-core with pgTable), MySQL (drizzle-orm/mysql-core with mysqlTable), and SQLite / Cloudflare D1 / Turso (drizzle-orm/sqlite-core with sqliteTable).
How are DEFAULT expressions and foreign keys translated?
NOW() and CURRENT_TIMESTAMP map to .defaultNow(), gen_random_uuid() maps to .defaultRandom(), boolean and numeric literals map to .default(val), and inline REFERENCES other_table(col) clauses map to .references(() => otherTable.col).
Can I convert multiple CREATE TABLE statements at once?
Yes. Paste an entire migration file containing multiple CREATE TABLE statements (including comments and IF NOT EXISTS clauses) and every table will be emitted in order.
Does camelCase property mapping alter the underlying SQL column names?
No. In Drizzle ORM, the property key controls the TypeScript field name (for example, createdAt) while the string argument passed to the column builder (timestamp("created_at")) preserves the exact SQL column name in the database.