Prisma Schema Field Types

All Prisma scalar types, relation types and native type modifiers with DB mapping.

Searchable Prisma schema field type reference covering scalar types (String, Int, BigInt, Decimal, DateTime, Json), enums, relations and @db native-type modifiers, with default PostgreSQL column mapping.

What scalar types does Prisma support?

Prisma's built-in scalars are String, Boolean, Int, BigInt, Float, Decimal, DateTime, Json and Bytes. Each maps to a sensible database column by default, which you can override with a @db native-type attribute.

Prisma schema field types

Every field in a Prisma model has a type: a built-in scalar, an enum, another model (a relation), or a composite type. Each scalar maps to a default database column that you can override with a @db native-type modifier. This searchable reference lists the scalar types, relation forms and native modifiers with their default PostgreSQL mapping so you can model schemas precisely.

How it works

A field is name Type modifiers attributes. Optionality and lists are encoded with ? and [], and native database types are set with @db:

model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique @db.VarChar(320)
  balance   Decimal  @db.Decimal(12, 2)
  createdAt DateTime @default(now()) @db.Timestamptz(3)
  metadata  Json?
  posts     Post[]
}

The Prisma scalar (String, Decimal, DateTime) chooses the default column, and the @db attribute pins the exact native type. Relations link models by referencing the related model type plus a @relation mapping.

Tips and notes

  • Use Decimal (never Float) for money to avoid floating-point rounding.
  • DateTime defaults to timestamp(3); use @db.Timestamptz to store the zone.
  • Json is great for flexible blobs but cannot be deeply queried portably.
  • Append ? for nullable and [] for list; BigInt maps to 64-bit integers.