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 ServerMySQLSQLiteCockroachDBPrisma 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 ServerMySQLSQLiteCockroachDBPrisma 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.

Update behaviors (for foreign key references)

Update behaviorPostgreSQLMicrosoft SQL ServerMySQLSQLiteCockroachDBPrisma 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.

Indexes

IndexPostgreSQLMicrosoft SQL ServerMySQLSQLiteCockroachDBPrisma schemaPrisma ClientPrisma Migrate
UNIQUE✔️✔️✔️✔️✔️@unique and @@unique✔️✔️
WHERE✔️✔️✔️✔️✔️Not yet✔️Not yet
USING✔️✔️✔️✔️✔️type✔️Not yet
  • † Available in preview in 3.6.0 and later and in general availability in 4.0.0 and later, with the PostgreSQL connector only.

Algorithm specified via USING:

Index type (Algorithm)PostgreSQLMicrosoft SQL ServerMySQLSQLiteCockroachDBPrisma schemaPrisma ClientPrisma Migrate
B-tree✔️✔️✔️✔️✔️✔️†✔️Not yet
Hash✔️✔️✔️✔️✔️✔️†✔️Not yet
GiST✔️✔️NoNo✔️✔️†✔️*Not yet
GIN✔️✔️NoNo✔️✔️†✔️*Not yet
BRIN✔️✔️NoNo✔️✔️†✔️*Not yet
SP-GiST✔️✔️NoNo✔️✔️†✔️*Not yet
  • * Only available if natively supported by database.
  • † Available with the PostgreSQL connector only in Prisma versions 4.0.0 and later.

Misc

FeaturePostgreSQLMicrosoft SQL ServerMySQLSQLiteCockroachDBPrisma schemaPrisma ClientPrisma Migrate
Autoincrementing IDs✔️✔️✔️✔️✔️autoincrement()✔️✔️
Arrays✔️NoNoNo✔️[]✔️*✔️*
Enums✔️No✔️No✔️enum✔️*✔️*
Native database types✔️✔️✔️✔️✔️✔️✔️Not yet
SQL Views✔️✔️✔️✔️✔️Not yetNot yetNot yet
Authorization and user management✔️✔️✔️No✔️Not yetNot yetNot yet
JSON support✔️✔️✔️No✔️‡✔️*✔️*✔️*
Fuzzy/Phrase full text search✔️✔️✔️No✔️Not yetNot yetNot yet
Table inheritance✔️✔️NoNo✔️Not 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.
  • ‡ JSON arrays are not yet supported: see the CockroachDB connector page for details

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 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 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
Edit this page on GitHub