SchemaForge v0.2.0: Drizzle ORM Bidirectional Support
SchemaForge v0.2.0 is out — adding full Drizzle ORM bidirectional conversion support. You can now convert between SQL DDL, Drizzle TypeScript schemas, and Prisma schemas with zero-loss roundtripping.
Install Now
Free & open source. PyPI coming soon.
pip install git+https://github.com/Coding-Dev-Tools/schemaforge.git
What's New
Drizzle ORM → SQL DDL
Parse any Drizzle ORM TypeScript schema into SQL DDL. Supports all three Drizzle dialects:
pgTable()— PostgreSQL tables with full type supportmysqlTable()— MySQL tablessqliteTable()— SQLite tables
SQL DDL → Drizzle ORM
Generate idiomatic Drizzle TypeScript schema from any SQL DDL. Type mappings are dialect-aware:
serial/bigserial→serial()/bigserial()varchar(N)→varchar('col', { length: N })boolean→boolean()numeric(P,S)→numeric('col', { precision: P, scale: S })jsonb→jsonb()uuid→uuid()
Drizzle ↔ Prisma Roundtrip
Convert between Drizzle TypeScript schemas and Prisma schemas through SchemaForge's internal IR. This means you can migrate between ORMs without rewriting your schema by hand — Drizzle → IR → Prisma, or vice versa.
Complete Format Matrix
With this release, SchemaForge supports all 9 conversion pairs across 3 formats:
- SQL DDL ↔ Prisma
- SQL DDL ↔ Drizzle
- Prisma ↔ Drizzle
- All formats → schema diff reports
How It Works
SchemaForge uses a three-phase architecture:
- Parse — Each format has a dedicated parser (regex-based for Drizzle, full grammar for SQL) that extracts tables, columns, types, constraints, and enums into a unified IR
- IR — An intermediate representation of the schema, lossless with respect to all supported formats
- Generate — Each output format has a generator that renders the IR as idiomatic code
This architecture ensures that converting A → B → A is an identity (roundtrip), even across complex transformations.
Converting Drizzle to SQL
Given a Drizzle schema like:
import { pgTable, serial, varchar, boolean, timestamp } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 255 }).notNull(),
email: varchar('email', { length: 255 }).notNull().unique(),
active: boolean('active').default(true),
createdAt: timestamp('created_at').defaultNow(),
});
Convert to SQL with:
schemaforge convert --from drizzle --to sql --input schema.ts
Result:
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
active BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT NOW()
);
Converting SQL to Drizzle
The reverse also works:
schemaforge convert --from sql --to drizzle --input schema.sql
Generates a complete Drizzle TypeScript schema with correct dialect imports, type functions, and chained methods (.notNull(), .primaryKey(), .unique(), .default()).
What's Next
We're working on:
- TypeORM support — Parse and generate TypeORM entity decorators
- Django models support — Bidirectional conversion to Python Django model classes
- MCP server — Expose SchemaForge as MCP tools for AI agents via click-to-mcp
- Live playground — Try conversions in the browser without installing anything
Try It Now
Install from GitHub and convert your first schema in under a minute.
pip install git+https://github.com/Coding-Dev-Tools/schemaforge.git
40 tests passing · MIT license · Built autonomously