Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Prisma Schema

Overview of Prisma Schema

Learn how the Prisma schema defines your data sources, generators, and data model. Applies to Prisma ORM v7.

Data sources (Prisma ORM v7) (/docs/orm/v7/prisma-schema/overview/data-sources)

Generators

Generators in your Prisma schema specify what assets are generated when the prisma generate command is invoked. This page explains how to configure generators. Applies to Prisma ORM v7.

Schema location (Prisma ORM v7) (/docs/orm/v7/prisma-schema/overview/location)

Overview on Prisma Schema

Learn how the Prisma schema defines your data sources, generators, and data model. Applies to Prisma ORM v6.

Data sources (Prisma ORM v6) (/docs/orm/v6/prisma-schema/overview/data-sources)

Generators

Generators in your Prisma schema specify what assets are generated when the prisma generate command is invoked. This page explains how to configure generators. Applies to Prisma ORM v6.

Schema location

Documentation regarding proper location of Prisma Schema including default naming and multiple files. Applies to Prisma ORM v6.

Models

Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more. Applies to Prisma ORM v7.

Models

Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more. Applies to Prisma ORM v6.

Relations

A relation is a connection between two models in the Prisma schema. This page explains how you can define one-to-one, one-to-many and many-to-many relations in Prisma. Applies to Prisma ORM v7.

One-to-one relations (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/relations/one-to-one-relations)

One-to-many relations (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/relations/one-to-many-relations)

Many-to-many relations (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/relations/many-to-many-relations)

Self-relations (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/relations/self-relations)

Referential actions

Circular references or multiple cascade paths can cause validation errors on Microsoft SQL Server and MongoDB. Since the database does not handle these situations out of the box, learn how to solve this problem. Applies to Prisma ORM v7.

Relation mode

Manage relations between records with relation modes in Prisma. Applies to Prisma ORM v7.

Troubleshooting relations (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/relations/troubleshooting-relations)

Relations

A relation is a connection between two models in the Prisma schema. This page explains how you can define one-to-one, one-to-many and many-to-many relations in Prisma. Applies to Prisma ORM v6.

One-to-one relations

How to define and work with one-to-one relations in Prisma. Applies to Prisma ORM v6.

One-to-many relations

How to define and work with one-to-many relations in Prisma. Applies to Prisma ORM v6.

Many-to-many relations

How to define and work with many-to-many relations in Prisma. Applies to Prisma ORM v6.

Self-relations

How to define and work with self-relations in Prisma. Applies to Prisma ORM v6.

Referential actions

Referential actions let you define the update and delete behavior of related models on the database level. Applies to Prisma ORM v6.

Special rules for referential actions in SQL Server and MongoDB

Circular references or multiple cascade paths can cause validation errors on Microsoft SQL Server and MongoDB. Since the database does not handle these situations out of the box, learn how to solve this problem. Applies to Prisma ORM v6.

Relation mode

Manage relations between records with relation modes in Prisma. Applies to Prisma ORM v6.

Troubleshooting relations (Prisma ORM v6) (/docs/orm/v6/prisma-schema/data-model/relations/troubleshooting-relations)

Database mapping (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/database-mapping)

Indexes (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/indexes)

Views

How to include views in your Prisma schema. Applies to Prisma ORM v7.

Multi-schema

How to use Prisma ORM with multiple database schemas. Applies to Prisma ORM v7.

External tables

How to declare and use externally managed tables in Prisma ORM. Applies to Prisma ORM v7.

Table inheritance (Prisma ORM v7) (/docs/orm/v7/prisma-schema/data-model/table-inheritance)

Database mapping (Prisma ORM v6) (/docs/orm/v6/prisma-schema/data-model/database-mapping)

Indexes (Prisma ORM v6) (/docs/orm/v6/prisma-schema/data-model/indexes)

Views

How to include views in your Prisma schema. Applies to Prisma ORM v6.

Multi-schema

How to use Prisma ORM with multiple database schemas. Applies to Prisma ORM v6.

External tables

How to declare and use externally managed tables in Prisma ORM. Applies to Prisma ORM v6.

Table inheritance (Prisma ORM v6) (/docs/orm/v6/prisma-schema/data-model/table-inheritance)

What is introspection?

Learn how you can introspect your database to generate a data model into your Prisma schema. Applies to Prisma ORM v6.

PostgreSQL extensions

How to install and manage PostgreSQL extensions with Prisma ORM using customized migrations, and how to use them in Prisma Client. Applies to Prisma ORM v6.

What is introspection?

Learn how you can introspect your database to generate a data model into your Prisma schema. Applies to Prisma ORM v7.

PostgreSQL extensions

How to install and manage PostgreSQL extensions with Prisma ORM using customized migrations, and how to use them in Prisma Client. Applies to Prisma ORM v7.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu