This page gives an overview of the features which are provided by the databases that Prisma supports. Additionally, it explains how each of these features can be used in Prisma with pointers to further documentation.

Relational database features

This section describes which database features exist on the databases that are currently supported by Prisma. The Prisma schema column indicates how a certain feature can be represented in the Prisma schema and links to its documentation. Note that database features can be used in Prisma Client even though they might not yet be representable in the Prisma schema.

If a feature is not supported natively by the database, it's also not available in Prisma.


ConstraintPostgreSQLMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
PRIMARY KEY✔️✔️✔️@id and @@id✔️✔️
FOREIGN KEY✔️✔️✔️Relation fields✔️✔️
UNIQUE✔️✔️✔️@unique and @@unique✔️✔️
CHECK✔️*✔️Not yet✔️Not yet
NOT NULL✔️✔️✔️?✔️✔️

*In MySQL 8 and higher

Deletion behaviors (for foreign key references)

Deletion behaviorPostgreSQLMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
CASCADE✔️✔️✔️Not yet✔️Not yet
RESTRICT✔️✔️✔️Not yet✔️Not yet
NO ACTION✔️✔️✔️Not yet✔️Not yet
SET DEFAULT✔️✔️✔️Not yet✔️Not yet
SET NULL✔️✔️✔️Not yet✔️Not yet

Update behaviors (for foreign key references)

Update behaviorPostgreSQLMySQLSQLitePrisma schemaPrisma MigratePrisma Client
CASCADE✔️✔️✔️Not yet✔️Not yet
RESTRICT✔️✔️✔️Not yet✔️Not yet
NO ACTION✔️✔️✔️Not yet✔️Not yet
SET DEFAULT✔️✔️✔️Not yet✔️Not yet
SET NULL✔️✔️✔️Not yet✔️Not yet


IndexPostgreSQLMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
UNIQUE✔️✔️✔️@unique and @@unique✔️Not yet
WHERE✔️✔️✔️Not yet✔️Not yet
USING✔️✔️✔️Not yet✔️Not yet

Algorithm specified via USING:

Index type (Algorithm)PostgreSQLMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
B-tree✔️✔️✔️Not yet✔️Not yet
Hash✔️✔️✔️Not yet✔️Not yet
GiST✔️NoNoNot yet✔️Not yet
GIN✔️NoNoNot yet✔️Not yet
BRIN✔️NoNoNot yet✔️Not yet
SP-GiST✔️NoNoNot yet✔️Not yet


FeaturePostgreSQLMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
Autoincrementing IDs✔️✔️✔️autoincrement()✔️✔️
Native database types✔️✔️✔️Not yet✔️Not yet
SQL Views✔️✔️✔️Not yetNot yetNot yet
Authorization and user management✔️✔️NoNot yetNot yetNot yet
JSON support✔️✔️No✔️Not yetNot yet
Fuzzy/Phrase full text search✔️✔️NoNot yetNot yetNot yet
Table inheritance✔️NoNoNot yet✔️Not yet

Prisma features

This section provides a high-level overview of the features that are provided by Prisma. Some features directly map to a feature in the underlying database, others are implemented by Prisma's query engine and therefore provide features that would not be available when using plain SQL.

Data modeling

You can find a full reference of all data modeling features on the Data model page.


The following functions are implemented by Prisma's query engine:

uuid()Generates a UUID value
cuid()Generates a cuid value

uuid() and cuid() are commonly used to set default values for ID fields.

The following functions are available in Prisma and map to underlying database features:

autoincrement()via the SERIAL typevia the AUTO_INCREMENT keywordvia the AUTOINCREMENT keywordGenerates an autoincrementing integer
now()CURRENT_TIMESTAMP and aliases like now()CURRENT_TIMESTAMP and aliases like now()date('now')Returns the current time

autoincrement() is commonly used to generated autoincrementing [ID](../tools-and-interfaces/prisma-schema/data-model ../tools-and-interfaces/prisma-schema/data-model#ids) values. now() is commonly used to initialize "createdAt"-fields that store the point in time when a record was created.


The following attributes are available in Prisma. They either map to a database feature or are implemented by Prisma's query engine:

NameDatabase representationDescription
@idPRIMARY KEYDefines a single-field ID on the model.
@@idPRIMARY KEYDefines a multi-field ID on the model.
@defaultDEFAULTDefines a default value for this field. @default takes an expression as an argument.
@uniqueUNIQUEDefines a unique constraint for this field.
@@uniqueUNIQUEDefines a compound unique constraint for the specified fields.
@@indexINDEXDefines an index.
@relationn/a*Defines meta information about the relation. Learn more.
@mapn/a*Maps a field name from the Prisma schema to a different column name.
@@mapn/a*Maps a model name from the Prisma schema to a differenttable name.
@updatedAtn/a**Automatically stores the time when a record was last updated.

*A Prisma feature that doesn't map directly to the database

**Implemented by Prisma's query engine

Queries (Prisma Client API)

  • CRUD
  • Fully type-safe
  • Autocompleting database queries
  • Field selection
  • Raw database access
  • Filtering
  • Ordering
  • Pagination
  • Bi-directional and self-referenced relations
  • Transactions
Edit this page on Github