Prisma Schema API - Prisma Documentation
Prisma Schema API - Prisma Documentation
/docs
ORM Reference
Prisma schema reference
datasource
Defines a data source in the Prisma schema.
Fields
A datasource block accepts the following fields:
Name Required Type Description
provid Yes String ( postgresql , Describes which data source connectors to use.
er mysql , sqlite ,
sqlserver , mongodb ,
cockroachdb )
url Yes String (URL) Connection URL including authentication info. Most
connectors use the syntax provided by the database.
shadow No String (URL) Connection URL to the shadow database used by
Databas Prisma Migrate. Allows you to use a cloud-hosted
eUrl database as the shadow database.
direct No String (URL) Connection URL for direct connection to the
Url database.
If you use a connection pooler URL in the url
argument (for example, if you use Prisma Accelerate
or pgBouncer), Prisma CLI commands that require a
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 1/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Remarks
You can only have one datasource block in a schema.
datasource db is convention - however, you can give your data source any name - for
example, datasource mysql or datasource data .
Examples
Specify a PostgreSQL data source
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 2/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
In this example, the target database is available with the following credentials:
User: johndoe
Password: mypassword
Host: localhost
Port: 5432
Database name: mydb
Schema name: public
datasource db {
provider = "postgresql"
url = "postgresql://johndoe:mypassword@localhost:5432/mydb?schema=public"
}
When running a Prisma CLI command that needs the database connection URL (e.g. prisma
generate ), you need to make sure that the DATABASE_URL environment variable is set.
One way to do so is by creating a .env file with the following contents. Note that the file
must be in the same directory as your schema.prisma file to automatically picked up the
Prisma CLI.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 3/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
DATABASE_URL=postgresql://johndoe:mypassword@localhost:5432/mydb?schema=public
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 4/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
The format for connection strings is the same as for PostgreSQL. Learn more about
PostgreSQL connection strings here.
generator
Defines a generator in the Prisma schema.
Fields
A generator block accepts the following fields:
Name Required Type Description
provider Yes String (file path) or Describes which generator to use. This can point to a
Enum ( prisma- file that implements a generator or specify a built-in
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 5/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
binaryTargets options
The following tables list all supported operating systems with the name of platform to specify
in binaryTargets .
Unless specified otherwise, the default supported CPU architecture is x86_64.
macOS
Build OS Prisma engine build name
macOS Intel x86_64 darwin
Windows
Build OS Prisma engine build name
Windows windows
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 6/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Linux (Alpine on x86_64 architectures)
Build OS Prisma engine build name OpenSSL
Alpine (3.17 and newer) linux-musl-openssl-3.0.x * 3.0.x
Alpine (3.16 and older) linux-musl 1.1.x
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 8/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Examples
Specify the prisma-client-js generator with the default output , previewFeatures ,
engineType and binaryTargets
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 9/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
generator client {
provider = "prisma-client-js"
}
Note that the above generator definition is equivalent to the following because it uses the
default values for output , engineType and binaryTargets (and implicitly
previewFeatures ):
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
engineType = "library"
binaryTargets = ["native"]
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 10/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
generator client {
provider = "./my-generator"
}
model
Defines a Prisma model .
Remarks
Every record of a model must be uniquely identifiable. You must define at least one of the
following attributes per model:
@unique
@@unique
@id
@@id
Naming conventions
Model names must adhere to the following regular expression: [A-Za-z][A-Za-z0-9_]*
Model names must start with a letter and are typically spelled in PascalCase
Model names should use the singular form (for example, User instead of user , users or
Users )
Prisma ORM has a number of reserved words that are being used by Prisma ORM
internally and therefore cannot be used as a model name. You can find the reserved
words here and here .
Note: You can use the @@map attribute to map a model (for example, User ) to a table
with a different name that does not match model naming conventions (for example,
users ).
Order of fields
In version 2.3.0 and later, introspection lists model fields in the same order as the
corresponding columns in the database. Relation fields are listed after scalar fields.
Examples
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 11/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model fields
Fields are properties of models.
Remarks
Naming conventions
Must start with a letter
Typically spelled in camelCase
Must adhere to the following regular expression: [A-Za-z][A-Za-z0-9_]*
Note: You can use the @map attribute to map a field name to a column with a different
name that does not match field naming conventions: e.g. myField @map("my_field") .
MySQL varchar(191)
MongoDB String
SQLite TEXT
CockroachDB STRING
PostgreSQL
Native database type Native database type attribute Notes
text @db.Text
char(x) @db.Char(x)
varchar(x) @db.VarChar(x)
bit(x) @db.Bit(x)
varbit @db.VarBit
uuid @db.Uuid
xml @db.Xml
inet @db.Inet
MySQL
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 13/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
TEXT @db.Text
CHAR(x) @db.Char(x)
TINYTEXT @db.TinyText
MEDIUMTEXT @db.MediumText
LONGTEXT @db.LongText
MongoDB
String
@db.ObjectId Required if the underlying BSON type is OBJECT_ID (ID fields, relation
scalars)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 14/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
varchar(x) @db.VarChar(x)
nvarchar(x) @db.NVarChar(x)
text @db.Text
ntext @db.NText
xml @db.Xml
uniqueidentifier @db.UniqueIdentifier
SQLite
TEXT
CockroachDB
Native database type Native database type attribute Notes
STRING(x) | TEXT(x) | VARCHAR(x) @db.String(x)
CHAR(x) @db.Char(x)
"char" @db.CatalogSingleChar
BIT(x) @db.Bit(x)
VARBIT @db.VarBit
UUID @db.Uuid
INET @db.Inet
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 15/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Note that the xml and citext types supported in PostgreSQL are not currently supported in
CockroachDB.
Clients
Prisma Client JS
string
Boolean
True or false value.
Default type mappings
Connector Default mapping
PostgreSQL boolean
MySQL TINYINT(1)
MongoDB Bool
SQLite INTEGER
CockroachDB BOOL
PostgreSQL
Native database types Native database type attribute Notes
boolean @db.Boolean
MySQL
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 16/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
BIT(1) @db.Bit
MongoDB
Bool
SQLite
INTEGER
CockroachDB
Native database types Native database type attribute Notes
BOOL @db.Bool
Clients
Prisma Client JS
boolean
Int
MySQL INT
MongoDB Int
SQLite INTEGER
CockroachDB INT
PostgreSQL
Native database types Native database type attribute Notes
integer | int , int4 @db.Integer
oid @db.Oid
MySQL
Native Native database Notes
database type attribute
types
INT @db.Int
INT @db.UnsignedIn
UNSIGNED t
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 18/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
SMALLINT @db.UnsignedSm
UNSIGNED allInt
MEDIUMINT @db.MediumInt
MEDIUMINT @db.UnsignedMe
UNSIGNED diumInt
TINYINT @db.TinyInt TINYINT maps to if the max length is greater than 1 (for
Int
example, TINYINT(2) ) or the default value is anything other than
1 , 0 , or NULL . TINYINT(1) maps to Boolean .
YEAR @db.Year
MongoDB
Int
@db.Long
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 19/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
tinyint @db.TinyInt
bit @db.Bit
SQLite
INTEGER
CockroachDB
Native database Native database type Notes
types attribute
INTEGER | INT @db.Int8 Note that this differs from PostgreSQL, where integer
| INT8 and int are aliases for int4 and map to @db.Integer
INT4 @db.Int4
INT2 | @db.Int2
SMALLINT
SMALLSERIAL | @db.Int2
SERIAL2 @default(autoincreme
nt())
SERIAL | @db.Int4
SERIAL4 @default(autoincreme
nt())
SERIAL8 | @db.Int8
BIGSERIAL @default(autoincreme
nt())
Clients
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 20/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Prisma Client JS
number
BigInt
BigInt is available in version 2.17.0 and later.
Default type mappings
Connector Default mapping
PostgreSQL bigint
MySQL BIGINT
MongoDB Long
SQLite INTEGER
CockroachDB INTEGER
PostgreSQL
Native database types Native database type attribute Notes
bigint | int8 @db.BigInt
MySQL
Native database types Native database type attribute Notes
BIGINT @db.BigInt
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 21/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
MongoDB
Long
SQLite
INTEGER
CockroachDB
Native database Native database type Notes
types attribute
BIGINT | INT | @db.Int8 Note that this differs from PostgreSQL, where
INT8 int is an alias for int4
bigserial | @db.Int8
serial8 @default(autoincrement())
Clients
Client Type Description
Prisma Client JS BigInt See examples of working with BigInt
Float
Floating point number.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 22/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Float maps to Double in 2.17.0 and later - see release notes and
Video: Changes to the default mapping of Float in Prisma ORM 2.17.0 for more
information about this change.
Default type mappings
Connector Default mapping
PostgreSQL double precision
MySQL DOUBLE
MongoDB Double
SQLite REAL
PostgreSQL
Native database types Native database type attribute Notes
double precision @db.DoublePrecision
real @db.Real
MySQL
Native database types Native database type attribute Notes
FLOAT @db.Float
DOUBLE @db.Double
MongoDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 23/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Double
money @db.Money
smallmoney @db.SmallMoney
real @db.Real
SQLite connector
REAL
CockroachDB
Native database types Native database type attribute Notes
DOUBLE PRECISION | FLOAT8 @db.Float8
Clients
Prisma Client JS
number
Decimal
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 24/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
MySQL DECIMAL(65,30)
CockroachDB DECIMAL
PostgreSQL
Native database types Native database type attribute Notes
decimal | numeric @db.Decimal(p, s) †
money @db.Money
† p (precision), the maximum total number of decimal digits to be stored. s (scale), the
number of decimal digits that are stored to the right of the decimal point.
MySQL
Native database types Native database type attribute Notes
DECIMAL | NUMERIC @db.Decimal(p, s) †
† p (precision), the maximum total number of decimal digits to be stored. s (scale), the
number of decimal digits that are stored to the right of the decimal point.
MongoDB
Not supported .
Microsoft SQL Server
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 25/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
† p (precision), the maximum total number of decimal digits to be stored. s (scale), the
number of decimal digits that are stored to the right of the decimal point.
SQLite
DECIMAL (changed from REAL in 2.17.0)
CockroachDB
Native database Native database type Notes
types attribute
DECIMAL | DEC | @db.Decimal(p, s) †
NUMERIC
† p (precision), the maximum total number of decimal digits to be stored. s (scale), the
number of decimal digits that are stored to the right of the decimal point.
Clients
Client Type Description
Prisma Client JS Decimal See examples of working with Decimal
DateTime
Remarks
Prisma Client returns all DateTime as native Date objects.
Currently, Prisma ORM does not support zero dates ( 0000-00-00 00:00:00 , 0000-
00-00 , 00:00:00 ) in MySQL.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 26/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
MySQL DATETIME(3)
MongoDB Timestamp
SQLite NUMERIC
CockroachDB TIMESTAMP
PostgreSQL
Native database types Native database type attribute Notes
timestamp(x) @db.Timestamp(x)
timestamptz(x) @db.Timestamptz(x)
date @db.Date
time(x) @db.Time(x)
timetz(x) @db.Timetz(x)
MySQL
Native database types Native database type attribute Notes
DATETIME(x) @db.DateTime(x)
DATE(x) @db.Date(x)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 27/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
TIMESTAMP(x) @db.Timestamp(x)
MongoDB
Timestamp
time @db.Time
datetime @db.DateTime
datetime2 @db.DateTime2
smalldatetime @db.SmallDateTime
datetimeoffset @db.DateTimeOffset
SQLite
NUMERIC or STRING . If the underlying data type is STRING , you must use one of the following
formats:
RFC 3339 ( 1996-12-19T16:39:57-08:00 )
RFC 2822 ( Tue, 1 Jul 2003 10:52:37 +0200 )
CockroachDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 28/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
TIMESTAMPTZ(x) @db.Timestamptz(x)
DATE @db.Date
TIME(x) @db.Time(x)
TIMETZ(x) @db.Timetz(x)
Clients
Prisma Client JS
Date
Json
A JSON object.
Default type mappings
Connector Default mapping
PostgreSQL jsonb
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 29/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
PostgreSQL
Native database types Native database type attribute Notes
json @db.Json
jsonb @db.JsonB
MySQL
Native database types Native database type attribute Notes
JSON @db.Json
MongoDB
A valid BSON object (Relaxed mode)
Microsoft SQL Server
Microsoft SQL Server does not have a specific data type for JSON - however, there are a
number of built-in functions for reading and modifying JSON .
Native database types Native database type attribute
JSON @db.NVarChar
SQLite
Not supported
CockroachDB
Native database types Native database type attribute Notes
JSON | JSONB @db.JsonB
Clients
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 30/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Prisma Client JS
object
Bytes
Bytes is available in version 2.17.0 and later.
Default type mappings
Connector Default mapping
PostgreSQL bytea
MySQL LONGBLOB
MongoDB BinData
SQLite BLOB
CockroachDB BYTES
PostgreSQL
Native database types Native database type attribute
bytea @db.ByteA
MySQL
Native database types Native database type attribute Notes
LONGBLOB @db.LongBlob
BINARY @db.Binary
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 31/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
TINYBLOB @db.TinyBlob
BLOB @db.Blob
MEDIUMBLOB @db.MediumBlob
BIT @db.Bit
MongoDB
BinData
varbinary @db.VarBinary
image @db.Image
SQLite
BLOB
CockroachDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 32/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Clients
Client Type Description
Prisma Client JS Buffer See examples of working with Buffer
Unsupported
WARNING
These fields are not supported by Prisma Client, because Prisma does not curre
* Model "Post", field: "circle", original data type: "circle"
Examples
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 33/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model Star {
id Int @id @default(autoincrement())
position Unsupported("circle")?
example1 Unsupported("circle")
circle Unsupported("circle")? @default(dbgenerated("'<(10,4),11>'::circle"))
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 34/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
? modifier
Makes a field optional.
Remarks
Cannot be used with a list field (for example, Posts[] )
Examples
Optional name field
model User {
id Int @id @default(autoincrement())
name String?
}
Attributes
Attributes modify the behavior of a field or block (e.g. models). There are two ways to add
attributes to your data model:
Field attributes are prefixed with @
Block attributes are prefixed with @@
Some attributes take arguments. Arguments in attributes are always named, but in most cases
the argument name can be omitted.
Note: The leading underscore in a signature means the argument name can be omitted.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 35/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
@id
Defines a single-field ID on the model.
Remarks
General
Cannot be defined on a relation field
Cannot be optional
Relational databases
Corresponding database construct: PRIMARY KEY
Can be annotated with a @default attribute that uses functions to auto-generate an ID:
autoincrement()
cuid()
uuid()
Optionally, annotate your field with a @default attribute that uses the auto()
function to auto-generate an ObjectId
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 36/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
cuid() and uuid() are supported but do not generate a valid ObjectId - use auto()
instead for @id
autoincrement() is not supported
Arguments
Name Required Type Description
map No Strin The name of the underlying primary key constraint in the database.
g
Not supported for MySQL or MongoDB.
length No numbe Allows you to specify a maximum length for the subpart of the value to
r be indexed.
MySQL only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
sort No Strin Allows you to specify in what order the entries of the ID are stored in
g the database. The available options are Asc and Desc .
SQL Server only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
cluster No Boole Defines whether the ID is clustered or non-clustered. Defaults to
ed an true .
SQL Server only. In preview in versions 3.13.0 and later, and in general
availability in versions 4.0.0 and later.
Signature
@id(map: String?, length: number?, sort: String?, clustered: Boolean?)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 37/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Note: Before version 4.0.0, or 3.5.0 with the extendedIndexes Preview feature enabled,
the signature was:
@id(map: String?)
Examples
In most cases, you want your database to create the ID. To do this, annotate the ID field with
the @default attribute and initialize the field with a function.
Generate autoincrementing integers as IDs (Relational databases only)
model User {
id Int @id @default(autoincrement())
name String
}
Note that in the above case, you must provide your own ID values when creating new records
for the User model using Prisma Client, e.g.:
const newUser = await prisma.user.create({
data: {
id: 1,
name: 'Alice',
},
})
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 39/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model Profile {
authorId Int @id
author User @relation(fields: [authorId], references: [id])
bio String
}
model User {
id Int @id
email String @unique
name String?
profile Profile?
}
In this scenario, you cannot create a Profile only - you must use Prisma Client's nested
writes create a User or connect the profile to an existing user.
The following example creates a user and a profile:
const userWithProfile = await prisma.user.create({
data: {
id: 3,
email: '[email protected]',
name: 'Bob Prismo',
profile: {
create: {
bio: "Hello, I'm Bob Prismo and I love apples, blue nail varnish, and the
},
},
},
})
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 40/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
@@id
WARNING
Arguments
Name Required Type Description
field Yes FieldRef A list of field names - for example, ["firstname", "lastname"]
s erence[]
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 41/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
map No String The name of the underlying primary key constraint in the database.
Not supported for MySQL.
lengt No number Allows you to specify a maximum length for the subpart of the value
h to be indexed.
MySQL only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
sort No String Allows you to specify in what order the entries of the ID are stored in
the database. The available options are Asc and Desc .
SQL Server only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
cluste No Boolean Defines whether the ID is clustered or non-clustered. Defaults to
red true .
The name of the fields argument on the @@id attribute can be omitted:
@@id(fields: [title, author])
@@id([title, author])
Signature
@@id(_ fields: FieldReference[], name: String?, map: String?)
Examples
Specify a multi-field ID on two String fields (Relational databases only)
model User {
firstName String
lastName String
email String @unique
isAdmin Boolean @default(false)
@@id([firstName, lastName])
}
When you create a user, you must provide a unique combination of firstName and lastName :
const user = await prisma.user.create({
data: {
firstName: 'Alice',
lastName: 'Smith',
},
})
Specify a multi-field ID on two String fields and one Boolean field (Relational databases only)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 43/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model User {
firstName String
lastName String
email String @unique
isAdmin Boolean @default(false)
When creating new User records, you now must provide a unique combination of values for
firstName , lastName and isAdmin :
@@id([authorId, title])
}
model User {
id Int @default(autoincrement())
email String @unique
name String?
posts Post[]
}
When creating new Post records, you now must provide a unique combination of values for
authorId (foreign key) and title :
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 44/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
@default
Defines a default value for a field.
Remarks
Default values that cannot yet be represented in the Prisma schema are represented by
the dbgenerated() function when you use introspection.
Default values are not allowed on relation fields in the Prisma schema. Note however that
you can still define default values on the fields backing a relation (the ones listed in the
fields argument in the @relation attribute). A default value on the field backing a
relation will mean that relation is populated automatically for you.
Default values can be used with scalar lists in databases that natively support them.
Relational databases
Corresponding database construct: DEFAULT
Default values can be a static value ( 4 , "hello" ) or one of the following functions:
autoincrement()
sequence() (CockroachDB only)
dbgenerated(...)
cuid()
uuid()
now()
Default values that cannot yet be represented in the Prisma schema are represented by
the dbgenerated(...) function when you use introspection.
Default values are not allowed on relation fields in the Prisma schema. Note however that
you can still define default values on the fields backing a relation (the ones listed in the
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 45/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
fields argument in the @relation attribute). A default value on the field backing a
relation will mean that relation is populated automatically for you.
Default values can be used with scalar lists in databases that natively support them.
JSON data. Note that JSON needs to be enclosed with double-quotes inside the
@default attribute, e.g.: @default("[]") . If you want to provide a JSON object, you
need to enclose it with double-quotes and then escape any internal double quotes using
a backslash, e.g.: @default("{ \"hello\": \"world\" }") .
MongoDB
Default values can be a static value ( 4 , "hello" ) or one of the following functions:
auto() (can only be used with @db.ObjectId to generate an ObjectId in MongoDB)
cuid()
uuid()
now()
Arguments
Name Required Type Description
value Yes An expression (e.g. 5 , true , now() )
map No String SQL Server only.
The name of the value argument on the @default attribute can be omitted:
id Int @id @default(value: autoincrement())
id Int @id @default(autoincrement())
Signature
@default(_ value: Expression, map: String?)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 46/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Examples
Default value for an Int
Relational databases MongoDB
model User {
email String @unique
profileViews Int @default(0)
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 47/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 48/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
enum Role {
USER
ADMIN
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
role Role @default(USER)
posts Post[]
profile Profile?
}
enum Role {
USER
DEVELOPER
ADMIN
}
@unique
Defines a unique constraint for this field.
Remarks
General
A field annotated with @unique can be optional or required
A field annotated with @unique must be required if it represents the only unique
constraint on a model without an @id / @@id
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 49/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
length No numbe Allows you to specify a maximum length for the subpart of the value to
r be indexed.
MySQL only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
sort No Strin Allows you to specify in what order the entries of the constraint are
g stored in the database. The available options are Asc and Desc .
In preview in versions 3.5.0 and later, and in general availability in
versions 4.0.0 and later.
cluste No Boole Defines whether the constraint is clustered or non-clustered. Defaults to
red an false .
SQL Server only. In preview in versions 3.13.0 and later, and in general
availability in versions 4.0.0 and later.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 50/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Note: Before version 4.0.0, or 3.5.0 with the extendedIndexes Preview feature enabled,
the signature was:
@unique(map: String?)
Examples
Specify a unique attribute on a required String field
Relational databases MongoDB
model User {
email String @unique
name String
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 51/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model User {
id Int @id @default(autoincrement())
email String? @unique
name String
Post Post[]
}
@@unique
Defines a compound unique constraint for the specified fields.
Remarks
General
All fields that make up the unique constraint must be mandatory fields. The following
model is not valid because id could be null :
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 52/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model User {
firstname Int
lastname Int
id Int?
The reason for this behavior is that all connectors consider null values to be distinct,
which means that two rows that look identical are considered unique:
firstname | lastname | id
-----------+----------+------
John | Smith | null
John | Smith | null
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 53/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
map No String
length No number Allows you to specify a maximum length for the subpart of the
value to be indexed.
MySQL only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
sort No String Allows you to specify in what order the entries of the constraint are
stored in the database. The available options are Asc and Desc .
In preview in versions 3.5.0 and later, and in general availability in
versions 4.0.0 and later.
cluste No Boolean Defines whether the constraint is clustered or non-clustered.
red Defaults to false .
SQL Server only. In preview in versions 3.13.0 and later, and in
general availability in versions 4.0.0 and later.
The name of the fields argument on the @@unique attribute can be omitted:
@@unique(fields: [title, author])
@@unique([title, author])
@@unique(fields: [title, author], name: "titleAuthor")
The length and sort arguments are added to the relevant field names:
@@unique(fields: [title(length:10), author])
@@unique([title(sort: Desc), author(sort: Asc)])
Signature
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 54/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Note: Before version 4.0.0, or before version 3.5.0 with the extendedIndexes Preview
feature enabled, the signature was:
@@unique(_ fields: FieldReference[], name: String?, map: String?)
Examples
Specify a multi-field unique attribute on two String fields
Relational databases MongoDB
model User {
id Int @default(autoincrement())
firstName String
lastName String
isAdmin Boolean @default(false)
@@unique([firstName, lastName])
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 55/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Specify a multi-field unique attribute on two String fields and one Boolean field
Relational databases MongoDB
model User {
id Int @default(autoincrement())
firstName String
lastName String
isAdmin Boolean @default(false)
@@unique([authorId, title])
}
model User {
id Int @id @default(autoincrement())
email String @unique
posts Post[]
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 56/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model User {
id Int @default(autoincrement())
firstName String
lastName String
isAdmin Boolean @default(false)
@@index
Defines an index in the database.
Remarks
Relational databases
Corresponding database construct: INDEX
There are some additional index configuration options that cannot be provided via the
Prisma schema yet. These include:
PostgreSQL and CockroachDB:
Define index fields as expressions (e.g. CREATE INDEX title ON public."Post"
((lower(title)) text_ops); )
Define partial indexes with WHERE
Create indexes concurrently with CONCURRENTLY
INFO
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 57/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
While you cannot configure these option in your Prisma schema, you can still configure
them on the database-level directly.
MongoDB
In version 3.12.0 and later, you can define an index on a field of a composite type using
the syntax @@index([compositeType.field]) . See Defining composite type indexes for
more details.
Arguments
Name Required Type Description
field Yes FieldRef A list of field names - for example, ["firstname", "lastname"]
s erence[]
name No String The name that Prisma Client will expose for the argument covering all
fields, e.g. fullName in fullName: { firstName: "First",
lastName: "Last"}
map No map The name of the index in the underlying database (Prisma generates
an index name that respects identifier length limits if you do not
specify a name. Prisma uses the following naming convention:
tablename.field1_field2_field3_unique )
lengt No number Allows you to specify a maximum length for the subpart of the value
h to be indexed.
MySQL only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
sort No String Allows you to specify in what order the entries of the index or
constraint are stored in the database. The available options are asc
and desc .
In preview in versions 3.5.0 and later, and in general availability in
versions 4.0.0 and later.
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 58/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
SQL Server only. In preview in versions 3.5.0 and later, and in general
availability in versions 4.0.0 and later.
type No identifi Allows you to specify an index access method. Defaults to BTree .
er
PostgreSQL and CockroachDB only. In preview with the Hash index
access method in versions 3.6.0 and later, and with the Gist , Gin ,
SpGist and Brin methods added in 3.14.0. In general availability in
versions 4.0.0 and later.
ops No identifi Allows you to define the index operators for certain index types.
er or a
function PostgreSQL only. In preview in versions 3.14.0 and later, and in
general availability in versions 4.0.0 and later.
The name of the fields argument on the @@index attribute can be omitted:
@@index(fields: [title, author])
@@index([title, author])
The length and sort arguments are added to the relevant field names:
@@index(fields: [title(length:10), author])
@@index([title(sort: Asc), author(sort: Desc)])
Signature
@@index(_ fields: FieldReference[], map: String?)
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 59/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
The old name argument will still be accepted to avoid a breaking change.
Examples
Assume you want to add an index for the title field of the Post model
Define a single-column index (Relational databases only)
model Post {
id Int @id @default(autoincrement())
title String
content String?
@@index([title])
}
@@index([title, content])
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 60/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
type Address {
street String
number Int
}
model User {
id Int @id
email String
address Address
@@index([address.number])
}
@relation
Defines meta information about the relation. Learn more.
Remarks
Relational databases
Corresponding database constructs: FOREIGN KEY / REFERENCES
MongoDB
If your model's primary key is of type ObjectId in the underlying database, both the
primary key and the foreign key must have the @db.ObjectId attribute
Arguments
Name Type Required Description Example
name String Sometimes (e.g. to Defines the name of the "CategoryOnPos
disambiguate a relationship. In an m-n-relation, t" ,
relation) it also determines the name of "MyRelation"
the underlying relation table.
field FieldReferenc On annotated A list of fields of the current ["authorId"] ,
s e[] relation fields model ["authorFirstN
ame,
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 61/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
The name of the name argument on the @relation attribute can be omitted ( references is
required):
@relation(name: "UserOnPost", references: [id])
@relation("UserOnPost", references: [id])
// or
@relation(name: "UserOnPost")
@relation("UserOnPost")
Signature
@relation(_ name: String?, fields: FieldReference[]?, references: FieldReference[
Examples
See: The @relation attribute.
@map
Maps a field name or enum value from the Prisma schema to a column or document field with
a different name in the database. If you do not use @map , the Prisma field name matches the
column name or document field name exactly.
See Using custom model and field names to see how @map and @@map changes the
generated Prisma Client.
Remarks
General
@map does not rename the columns / fields in the database
@map does change the field names in the generated client
MongoDB
Your @id field must include @map("_id") . For example:
model User {
id String @default(auto()) @map("_id") @db.ObjectId
}
Arguments
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 63/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
The name of the name argument on the @map attribute can be omitted:
@map(name: "is_admin")
@map("users")
Signature
@map(_ name: String)
Examples
Map the firstName field to a column called first_name
Relational databases MongoDB
model User {
id Int @id @default(autoincrement())
firstName String @map("first_name")
}
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 64/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
enum Role {
ADMIN @map("admin")
CUSTOMER
}
@@map
Maps the Prisma schema model name to a table (relational databases) or collection
(MongoDB) with a different name, or an enum name to a different underlying enum in the
database. If you do not use @@map , the model name matches the table (relational databases)
or collection (MongoDB) name exactly.
See Using custom model and field names to see how @map and @@map changes the
generated Prisma Client.
Arguments
Name Type Required Description Example
nam Strin Yes The database table (relational databases) "comments" ,
e g or collection (MongoDB) name. "someTableOrCollection
Name"
The name of the name argument on the @@map attribute can be omitted
@@map(name: "users")
@@map("users")
Signature
@@map(_ name: String)
Examples
Map the User model to a database table/collection named users
Relational databases MongoDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 65/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model User {
id Int @id @default(autoincrement())
name String
@@map("users")
}
Map the Role enum to a native enum in the database named _Role its values to lowercase values in the
database
enum Role {
ADMIN @map("admin")
CUSTOMER @map("customer")
@@map("_Role")
}
@updatedAt
Automatically stores the time when a record was last updated. If you do not supply a time
yourself, Prisma Client will automatically set the value for fields with this attribute.
Remarks
Compatible with DateTime fields
Implemented at Prisma ORM level
Arguments
N/A
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 66/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Signature
@updatedAt
Examples
Relational databases MongoDB
model Post {
id String @id
updatedAt DateTime @updatedAt
}
@ignore
Add @ignore to a field that you want to exclude from Prisma Client (for example, a field that
you do not want Prisma Client users to update). Ignored fields are excluded from the
generated Prisma Client. The model's create method is disabled when doing this for required
fields with no @default (because the database cannot create an entry without that data).
Remarks
In 2.17.0 and later, Prisma ORM automatically adds @ignore to fields that refer to
invalid models when you introspect.
Examples
The following example demonstrates manually adding @ignore to exclude the email field
from Prisma Client:
schema.prisma
model User {
id Int @id
name String
email String @ignore // this field will be excluded
}
@@ignore
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 67/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Add @@ignore to a model that you want to exclude from Prisma Client (for example, a model
that you do not want Prisma users to update). Ignored models are excluded from the
generated Prisma Client.
Remarks
In 2.17.0 and later, Prisma ORM adds @@ignore to an invalid model. (It also adds
@ignore to relations pointing to such a model)
Examples
In the following example, the Post model is invalid because it does not have a unique
identifier. Use @@ignore to exclude it from the generated Prisma Client API:
schema.prisma
/// The underlying table does not contain a valid unique identifier and can there
model Post {
id Int @default(autoincrement()) // no unique identifier
author User @relation(fields: [authorId], references: [id])
authorId Int
@@ignore
}
In the following example, the Post model is invalid because it does not have a unique
identifier, and the posts relation field on User is invalid because it refers to the invalid Post
model. Use @@ignore on the Post model and @ignore on the posts relation field in User
to exclude both the model and the relation field from the generated Prisma Client API:
schema.prisma
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 68/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
/// The underlying table does not contain a valid unique identifier and can there
model Post {
id Int @default(autoincrement()) // no unique identifier
author User @relation(fields: [authorId], references: [id])
authorId Int
@@ignore
}
model User {
id Int @id @default(autoincrement())
name String?
posts Post[] @ignore
}
@@schema
WARNING
To use this attribute, you must have the multiSchema preview feature enabled.
Multiple database schema support is currently available with the PostgreSQL,
CockroachDB, and SQL Server connectors.
Add @@schema to a model to specify which schema in your database should contain the table
associated with that model.
Arguments
Name Type Required Description Example
name String Yes The name of the database schema. "base" , "auth"
The name of the name argument on the @@schema attribute can be omitted
@@schema(name: "auth")
@@schema("auth")
Signature
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 69/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Examples
Map the User model to a database schema named auth
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["auth"]
}
model User {
id Int @id @default(autoincrement())
name String
@@schema("auth")
}
INFO
For more information about using the multiSchema feature, refer to this guide.
Attribute functions
auto()
WARNING
Relational databases
The auto() function is not available on relational databases.
Example
Generate ObjectId (MongoDB only)
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String?
}
autoincrement()
WARNING
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 71/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Database Implementation
MySQL AUTO_INCREMENT attribute
SQLite AUTOINCREMENT keyword
CockroachDB SERIAL type
Examples
Generate autoincrementing integers as IDs (Relational databases only)
model User {
id Int @id @default(autoincrement())
name String
}
sequence()
INFO
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 72/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
Argument Example
incremen @default(sequence(increment: 4))
t The new value by which the sequence is incremented. A negative number creates a descending
sequence. A positive number creates an ascending sequence.
minValue @default(sequence(minValue: 10))
The new minimum value of the sequence.
maxValue @default(sequence(maxValue: 3030303))
The new maximum value of the sequence.
start @default(sequence(start: 2))
The value the sequence starts at, if it's restarted or if the sequence hits the maxValue .
Examples
Generate sequencing integers as IDs
model User {
id Int @id @default(sequence(maxValue: 4294967295))
name String
}
cuid()
Prisma Client errors such as Error: The provided value for the column is too long
for the column's type.
MongoDB
cuid() does not generate a valid ObjectId - use the @db.ObjectId syntax if you want
to use ObjectId in the underlying database. However, you can still use cuid() if your
_id field is not of type ObjectId .
Examples
Generate cuid() values as IDs
Relational databases MongoDB
model User {
id String @id @default(cuid())
name String
}
uuid()
Generate a globally unique identifier based on the UUID spec, version 4 (random).
Remarks
Compatible with String
Implemented by Prisma ORM and therefore not "visible" in the underlying database
schema. You can still use uuid() when using introspection by manually changing your
Prisma schema and generating Prisma Client, in that case the values will be generated by
Prisma ORM's query engine.
INFO
Note (Relational databases): If you do not want to use Prisma ORM's uuid()
function, you can use the native database function with dbgenerated .
MongoDB
uuid() does not generate a valid ObjectId - use the @db.ObjectId syntax if you want
to use ObjectId in the underlying database. However, you can still use uuid() if your
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 74/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
now()
Set a timestamp of the time when a record is created.
Remarks
General
Compatible with DateTime
Relational databases
Implemented on the database-level, meaning that it manifests in the database schema
and can be recognized through introspection. Database implementations:
Database Implementation
PostgreSQL CURRENT_TIMESTAMP and aliases like now()
MongoDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 75/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
dbgenerated(...)
Represents default values that cannot be expressed in the Prisma schema (such as
random() ).
Remarks
Relational databases
Compatible with any scalar type
Can not be an empty string dbgenerated("") in 2.21.0 and later
Accepts a String value in 2.17.0 and later, which allows you to:
Set default values for Unsupported types
Override default value behavior for supported types
String values in dbgenerated(...) might not match what the DB returns as the default
value, because values such as strings may be explicitly cast (e.g. 'hello'::STRING ).
When a mismatch is present, Prisma Migrate indicates a migration is still needed. You can
use prisma db pull to infer the correct value to resolve the discrepancy. (
Related issue )
Examples
Set default value for Unsupported type
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 76/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
INFO
enum
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 77/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
WARNING
Defines an enum .
Remarks
Enums are natively supported by PostgreSQL and MySQL
Enums are implemented and enforced at Prisma ORM level in MongoDB
Naming conventions
Enum names must start with a letter (they are typically spelled in PascalCase )
Enums must use the singular form (e.g. Role instead of role , roles or Roles ).
Must adhere to the following regular expression: [A-Za-z][A-Za-z0-9_]*
Examples
Specify an enum with two possible values
Relational databases MongoDB
enum Role {
USER
ADMIN
}
model User {
id Int @id @default(autoincrement())
role Role
}
Specify an enum with two possible values and set a default value
Relational databases MongoDB
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 78/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
enum Role {
USER
ADMIN
}
model User {
id Int @id @default(autoincrement())
role Role @default(USER)
}
type
WARNING
Composite types are available in versions 3.12.0 and later, and in versions 3.10.0 and
later if you enable the mongodb Preview feature flag.
Defines a composite type .
Naming conventions
Type names must:
start with a letter (they are typically spelled in PascalCase )
adhere to the following regular expression: [A-Za-z][A-Za-z0-9_]*
Examples
Define a Product model with a list of Photo composite types
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 79/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
model Product {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
photos Photo[]
}
type Photo {
height Int
width Int
url String
}
Previous Next
« Prisma Client API Prisma CLI »
PRODUCT
ORM
Studio
Optimize
Accelerate
Pulse
Pricing
Changelog
Data Platform status ↗
RESOURCES CONTACT US
Docs Community
Ecosystem Support
Playground ↗ Enterprise
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 80/81
11/1/24, 1:06 AM Prisma Schema API | Prisma Documentation
COMPANY
About
Blog
Data DX ↗
Careers
Security & Compliance
Legal
https://www.prisma.io/docs/orm/reference/prisma-schema-reference 81/81