Enums & Custom Types in Drizzle ORM

From the Drizzle ORM cheat sheet · Schema Definition · verified Jul 2026

Enums & Custom Types

Define PostgreSQL enums and use them in table schemas.

typescript
import { pgTable, serial, text,
  pgEnum } from 'drizzle-orm/pg-core';

export const roleEnum = pgEnum('role', [
  'admin', 'user', 'moderator'
]);

export const statusEnum = pgEnum('status', [
  'active', 'inactive', 'suspended'
]);

export const users = pgTable('users', {
  id: serial('id').primaryKey(),
  name: text('name').notNull(),
  role: roleEnum('role').default('user').notNull(),
  status: statusEnum('status').default('active').notNull(),
});
💡 pgEnum creates a real PostgreSQL ENUM type
⚡ Enum values are type-safe in TS automatically
📌 MySQL uses mysqlEnum() defined inline on column
🟢 Drizzle infers TS union type from enum values
schemaenumtypes

Continue with Drizzle ORM

Save the full cheat sheet or work through every related task.

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet