Microdeck.tools 100% In-Browser
Schema & Code Converter 100% In-Browser

Convert PostgreSQL DDL to Drizzle ORM pgTable Online

Generate idiomatic Drizzle ORM pgTable declarations directly from PostgreSQL CREATE TABLE DDL queries.

SQL Dialect:
Target Output:
drizzle Output✓ Parsed 1 table (AST transpiler)
import { pgTable, serial, varchar, integer, boolean, timestamp } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: serial("id").primaryKey(),
  email: varchar("email", { length: 255 }).notNull().unique(),
  full_name: varchar("full_name", { length: 100 }),
  age: integer("age").default(18),
  is_active: boolean("is_active").default(true),
  created_at: timestamp("created_at").defaultNow(),
});

Did this converter save you time? Completely optional · From $3 — keeps Microdeck fast and free.

ADVERTISEMENT
Privacy-Friendly Sponsor Unit
Contextual tech, developer, & creator tools sponsorship slot. Zero intrusive tracking.

Sample Conversion: PostgreSQL DDL → Drizzle pgTable

Input (PostgreSQL DDL)
CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  total_amount NUMERIC(10,2) NOT NULL
);
Output (Drizzle pgTable)
import { pgTable, serial, numeric } from "drizzle-orm/pg-core";

export const orders = pgTable("orders", {
  id: serial("id").primaryKey(),
  totalAmount: numeric("total_amount", { precision: 10, scale: 2 }).notNull(),
});

Frequently Asked Questions

Can I export TypeScript types with Drizzle?

Yes! Drizzle provides type InferSelectModel<typeof table> to infer database types.

Other Popular Database Schema Conversions

Support Microdeck

Completely optional · From $3 · No account required

Choose an amount (USD): Selected: $5

Minimum support amount is $3 USD.

Completely optional · From $3 · Checkout opens on Gumroad.