Database features matrix

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.

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

Relational database features

This section describes which database features exist on the relational 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.

Constraints

ConstraintPostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma 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✔️✔️

Deletion behaviors (for foreign key references)

Deletion behaviorPostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
CASCADE✔️✔️✔️✔️✔️✔️✔️
RESTRICT✔️No✔️✔️✔️✔️✔️
NO ACTION✔️✔️✔️✔️✔️✔️✔️
SET DEFAULT✔️✔️✔️✔️✔️✔️✔️
SET NULL✔️✔️✔️✔️✔️✔️✔️
  • † In 2.26.0 and later you can define referential actions on your relation fields. Referential actions determine what should happen to a record when a related record is deleted or updated. Note that referential actions are currently a Preview feature.

Update behaviors (for foreign key references)

Update behaviorPostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
CASCADE✔️✔️✔️✔️✔️✔️✔️
RESTRICT✔️No✔️✔️✔️✔️✔️
NO ACTION✔️✔️✔️✔️✔️✔️✔️
SET DEFAULT✔️✔️✔️✔️✔️✔️✔️
SET NULL✔️✔️✔️✔️✔️✔️✔️
  • † In 2.26.0 and later you can define referential actions on your relation fields. Referential actions determine what should happen to a record when a related record is deleted or updated. Note that referential actions are currently a Preview feature.

Indexes

IndexPostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
UNIQUE✔️✔️✔️✔️@unique and @@unique✔️✔️
WHERE✔️✔️✔️✔️Not yet✔️Not yet
USING✔️✔️✔️✔️Not yet✔️Not yet

Algorithm specified via USING:

Index type (Algorithm)PostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma 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

* Only available if natively supported by database.

Misc

FeaturePostgreSQLMicrosoft SQL ServerMySQLSQLitePrisma schemaPrisma ClientPrisma Migrate
Autoincrementing IDs✔️✔️✔️✔️autoincrement()✔️✔️
Arrays✔️NoNoNo[]✔️*✔️*
Enums✔️No✔️Noenum✔️*✔️*
Native database types✔️✔️✔️✔️✔️✔️Not yet
SQL Views✔️✔️✔️✔️Not yetNot yetNot yet
Authorization and user management✔️✔️✔️NoNot yetNot yetNot yet
JSON support✔️✔️✔️No✔️*✔️*✔️*
Fuzzy/Phrase full text search✔️✔️✔️NoNot yetNot yetNot yet
Table inheritance✔️✔️NoNoNot yet✔️*Not yet
  • * Only available if natively supported by database.
  • † Only supports JSON through SQL functions, but doesn't have a JSON column type. Therefore client JSON operations are not supported.

NoSQL database features

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

MongoDB

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

FeatureSupported by PrismaNotes
Embedded documentsNot formallyEmbedded documents are not formally supported, but you can technically use the Json field to manage embedded documents on your own. See GitHub issue #6708.
Transactions✔️
Indexes✔️ with caveatsYou cannot model indexes in the Prisma schema, but Prisma does not prevent you from creating indexes for your database.
Autoincrementing IDsNo
Compound IDsNoMongoDB does not support composite IDs (@@id)
Generated ObjectId✔️See: Defining IDs for MongoDB
Arrays✔️
Enums✔️Implemented at Prisma level
Native database types✔️See: Field mapping reference
JSON support✔️Advanced Json field filtering not supported
DBrefsNo
Change streamsNo
Direct access to the aggregation pipelineNo
Edit this page on GitHub