Drizzle Schema Generator
Define your table name and columns to generate a Drizzle ORM pgTable schema for PostgreSQL.
Choose column types, set nullable/primary key flags, and add defaults. Outputs both the table definition and the inferred TypeScript type.
Runs entirely in your browser — nothing is sent to a server.
Drizzle Column Type Reference
| Type | Drizzle Helper | TypeScript Type |
|---|---|---|
| text | text('col') | string |
| varchar | varchar('col', { length: 255 }) | string |
| integer | integer('col') | number |
| bigint | bigint('col', { mode: 'number' }) | number |
| boolean | boolean('col') | boolean |
| timestamp | timestamp('col') | Date |
| json | json('col') | unknown |
| uuid | uuid('col') | string |
| serial | serial('col') | number |
Frequently Asked Questions
What is Drizzle ORM and why use it?▼
Drizzle ORM is a TypeScript-first ORM for Node.js that gives you SQL-like syntax in TypeScript. Unlike Prisma, Drizzle generates no runtime client — it compiles your schema to raw SQL queries at build time. This means zero magic, full type safety, and excellent performance. It supports PostgreSQL, MySQL, and SQLite with a unified API.
What does pgTable do in Drizzle?▼
pgTable() is the core function for defining a PostgreSQL table in Drizzle ORM. You pass the table name as the first argument and a column definition object as the second. Each column is typed using helpers like text(), integer(), boolean(), timestamp(), etc. from drizzle-orm/pg-core. The result is a typed table object you use in queries.
What is $inferSelect and when do I use it?▼
$inferSelect is a TypeScript utility type provided by Drizzle that infers the TypeScript type of a row returned from a SELECT query on your table. Use it to type function parameters, API responses, or state variables without manually writing an interface. There is also $inferInsert for insert row types (which respects optional/default columns).
How do I use the generated schema in my project?▼
Copy the generated schema into a file like schema.ts in your project. Import drizzle-orm/pg-core at the top. Then import your table in query files and use it with a Drizzle db instance: db.select().from(yourTable). Drizzle reads the column types and builds fully typed SQL — autocomplete works in VSCode and TypeScript will catch type mismatches at compile time.
Related Products
on GumroadDevPlaybook Interview Vault
210+ real technical interview questions with model answers, asked at Google, Meta, Amazon, Microsoft, Stripe, and Shopify. Covers Frontend (55), Backend (55), System Design (50), and DSA (50). Available in English and Traditional Chinese.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Terraform Resource Generator
Generate Terraform HCL resource blocks for AWS, GCP, and Azure. Build EC2, S3, RDS, Compute Engine, Cloud Storage, and Azure VM configurations visually. Copy production-ready HCL output.
Open free tool →
Prisma Schema Visualizer
Paste your Prisma schema to instantly visualize it as an interactive ER diagram. Draggable model cards with color-coded field types and relation arrows.
Open free tool →
Terraform Variable Builder
Build Terraform variable declarations for variables.tf with a visual form. Set type, default value, description, sensitivity, and validation rules.
Open free tool →
More Free Tools
Related Articles
Drizzle ORM: The TypeScript-First Database Toolkit (Complete Guide 2026)
Complete guide to Drizzle ORM covering why Drizzle vs Prisma and TypeORM, schema definition, migrations with drizzle-kit, query builder patterns, Drizzle Studio, and serverless performance.
Prisma ORM vs Drizzle ORM: Which to Choose in 2026
A practical comparison of Prisma ORM vs Drizzle ORM for TypeScript developers. Covers schema syntax, query performance, migration workflow, type safety, database support, and a decision framework.
Prisma vs Drizzle vs TypeORM 2026: Which ORM Should You Choose?
Compare Prisma, Drizzle ORM, and TypeORM for your 2026 Node.js project. Real benchmarks, type safety comparison, migration support, bundle size, and community activity to help you decide.
Drizzle ORM vs Prisma 2026: Modern TypeScript Database Access
Compare Drizzle ORM and Prisma 5 for TypeScript projects. Type-safe SQL, migrations, performance, edge runtime support, and when to choose each.
Drizzle ORM Complete Guide: TypeScript Database Toolkit 2026
Master Drizzle ORM 2026: schema definition, migrations, relations, RLS support, and Drizzle Studio. See how it compares to Prisma for TypeScript projects.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →