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.
Note: If a feature is not supported natively by the database, it's also not available in Prisma ORM.
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.
Constraints
| Constraint | PostgreSQL | Microsoft SQL Server | MySQL | SQLite | CockroachDB | Prisma schema | Prisma Client | Prisma Migrate |
|---|---|---|---|---|---|---|---|---|
PRIMARY KEY | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | @id and @@id | ✔️ | ✔️ |
FOREIGN KEY | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | Relation fields | ✔️ | ✔️ |
UNIQUE | ✔️ | ✔️† | ✔️ | ✔️ | ✔️ | @unique and @@unique | ✔️ | ✔️ |
CHECK | ✔️ | ✔️ | ✔️* | ✔️ | ✔️ | Not yet | ✔️ | Not yet |
NOT NULL | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ? | ✔️ | ✔️ |
DEFAULT | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | @default | ✔️ | ✔️ |
Referential Actions (Delete and Update behaviors for foreign key references)
| Deletion behavior | PostgreSQL | Microsoft SQL Server | MySQL | SQLite | CockroachDB | Prisma schema | Prisma Client | Prisma 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
| Index | PostgreSQL | Microsoft SQL Server | MySQL | SQLite | CockroachDB | Prisma schema | Prisma Client | Prisma Migrate |
|---|---|---|---|---|---|---|---|---|
UNIQUE | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | @unique and @@unique | ✔️ | ✔️ |
USING | ✔️ | No | No | No | ✔️ | type† | ✔️ | ✔️† |
WHERE | ✔️ |