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

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet