Skip to main content

Database features matrix

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

Relational database features

This section describes which database features exist on the relational databases that are currently supported by Prisma ORM. 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.

note

These features are only for relational databases. Supported features for NoSQL databases, like MongoDB, can be found below.

Constraints

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

* Caveats apply when using the UNIQUE constraint with Microsoft SQL Server † Only supported in MySQL in version 8 and higher.

Referential Actions (Delete and Update behaviors for foreign key references)

Deletion behaviorSupportedPrisma schemaPrisma ClientPrisma Migrate
CASCADE✔️✔️✔️✔️
RESTRICT✔️*✔️✔️✔️
NO ACTION✔️✔️✔️✔️
SET DEFAULT✔️✔️✔️✔️
SET NULL✔️✔️✔️✔️

* RESTRICT is not supported in Microsoft SQL Server.

Indexes

IndexSupportedPrisma schemaPrisma ClientPrisma Migrate
UNIQUE✔️@unique and @@unique✔️✔️
USINGPostgreSQL onlytype✔️✔️
WHERE✔️Not yet✔️Not yet
(expression)✔️Not yet✔️Not yet
INCLUDEPostgreSQL and Microsoft SQL Server onlyNot yet✔️Not yet

Algorithm specified via USING:

Index type (Algorithm)SupportedPrisma schemaPrisma ClientPrisma Migrate
B-tree✔️✔️†✔️Not yet
Hash✔️✔️†✔️Not yet
GiST✔️*✔️†✔️*Not yet
GIN✔️*✔️†✔️*Not yet
BRIN✔️*✔️†✔️*Not yet
SP-GiST✔️*✔️†✔️*Not yet
  • * Not supported for MySQL and SQLite
  • † Available with the PostgreSQL connector only in Prisma ORM versions 4.0.0 and later.

Misc

FeatureSupportedPrisma schemaPrisma ClientPrisma Migrate
Autoincrementing IDs✔️autoincrement()✔️✔️
ArraysPostgreSQL only[]✔️✔️
Enums✔️*†enum✔️✔️
Native database types✔️✔️✔️Not yet
SQL Views✔️Not yetNot yetNot yet
JSON support✔️†✔️✔️✔️
Fuzzy/Phrase full text search✔️‡Not yetNot yetNot yet
Table inheritancePostgreSQL and Microsoft SQL Server onlyNot yet✔️Not yet
Authorization and user management✔️‡Not yetNot yetNot yet
  • * Not supported by Microsoft SQL Server
  • † JSON and Enum types are supported in SQLite as of Prisma ORM 6.2.0.
  • ‡ Not supported by SQLite

NoSQL database features

This section describes which database features exist on the NoSQL databases that are currently supported by Prisma ORM.

MongoDB

The following table lists common MongoDB features and describes the level of support offered by Prisma ORM:

FeatureSupported by Prisma ORMNotes
Embedded documents✔️
Transactions✔️
Indexes✔️ with caveatsIndexes can only be introspected if the field they refer to includes at least some data.
Autoincrementing IDsNo
Compound IDsNoMongoDB does not support composite IDs (@@id)
Generated ObjectId✔️See: Defining IDs for MongoDB
Arrays✔️
Enums✔️Implemented at Prisma ORM level
Native database types✔️See: Field mapping reference
JSON support✔️Advanced Json field filtering is not yet supported.
DBrefsNo
Change streamsNo
Direct access to the aggregation pipelineNo