Skip to main content
Columns define the structure and data types of your tables. Drizzle provides database-specific column types with full TypeScript inference.

Column modifiers

All column types support these common modifiers:

Available modifiers

1

.notNull()

Makes the column required (NOT NULL constraint)
2

.default()

Sets a default value for the column
3

.primaryKey()

Marks the column as the primary key
4

.unique()

Adds a unique constraint
5

.references()

Creates a foreign key reference

PostgreSQL column types

Integer types

Serial (auto-increment) types

Text types

Numeric types

Boolean type

Date and time types

JSON types

Network types

Other PostgreSQL types

MySQL column types

Integer types

Serial type

String types

Numeric types

Date and time types

Other MySQL types

SQLite column types

SQLite uses a flexible type system with type affinities:

Custom column types

Create custom column types for all databases:

Type inference

Drizzle automatically infers TypeScript types from your schema: