# Prisma Documentation ## Docs - [Front matter](about/docs-components/frontmatter): Meta information - [Prisma docs components](about/docs-components/index): In this section - [MDX components](about/docs-components/mdx-examples): This page describes how to use the custom MDX components (e.g. code blocks) in the Prisma docs. - [About](about/index): This section of our docs is about... the docs! - [Boilerplate content](about/style-guide/boilerplate-content): You can use the following phrases and blocks of content as templates when you work on the docs. - [Prisma docs image guidelines](about/style-guide/image-guidelines): Screenshots - [Prisma docs style guide](about/style-guide/index): This guide contains guidelines for contributors to the Prisma docs. Its goal is to ensure consistency throughout the Prisma docs and with other official Prisma materials. - [Prisma product and component names](about/style-guide/prisma-product-names): Use the following forms - [Docs example data model](about/style-guide/schema-models): User and Post are the canonical models that we use in our examples throughout the Prisma docs. - [Spelling, punctuation, and formatting](about/style-guide/spelling-punctuation-formatting): Avoid contractions - [User interface (GUI) guidelines](about/style-guide/user-interace-guidelines): Use numbered lists to document UI steps - [Word choice](about/style-guide/word-choice): Avoid words like "easy" and "just" - [Writing style](about/style-guide/writing-style): Audience - [Writing template](about/template): A template for writing Prisma Docs. - [API Reference](accelerate/api-reference): The Accelerate API reference documentation is based on the following schema: - [Caching](accelerate/caching): Prisma Accelerate provides global caching for read queries using TTL, Stale-While-Revalidate (SWR), or a combination of both. It's included as part of Prisma Postgres, but can also be used with your own database by enabling Accelerate in the Prisma Data Platform and configuring it with your database. - [Compare Accelerate](accelerate/compare): Prisma Accelerate supports products that serve a global audience, with a global caching system and connection pool that spans multiple regions, providing consistent access to data with low latency no matter where your user (or your database) is located in the world. - [Connection Pooling](accelerate/connection-pooling): Accelerate provides built-in connection pooling to efficiently manage database connections. It's included as part of Prisma Postgres, but you can also use it with your own database by enabling Accelerate in the Prisma Data Platform and connecting it to your database. - [Evaluating](accelerate/evaluating): Prisma Accelerate optimizes database interactions through advanced connection pooling and global edge caching. Its connection pooler is available in 16 regions and helps applications load-balance and scale database requests based on demand. - [Prisma Accelerate examples](accelerate/examples): Here is a list of ready-to-run example projects that demonstrate how to use Prisma Accelerate: - [FAQ](accelerate/faq): When should I enable static IP for Prisma Accelerate? - [Feedback](accelerate/feedback): You can submit any feedback about Accelerate in our Discord server. - [Getting started with Prisma Accelerate](accelerate/getting-started): Prerequisites - [](accelerate/index): Prisma Accelerate - [Known limitations](accelerate/known-limitations): Below are descriptions of known limitations when using Accelerate. If you encounter any additional ones, please share them with us via Discord. - [Local development](accelerate/local-development): Prisma Accelerate efficiently scales production traffic with integrated connection pooling and a global database cache. - [Static IP](accelerate/static-ip): You can enable static IP for Accelerate when your security setup requires IP allowlisting or if you're implementing firewalls that only permit access from trusted IPs, ensuring controlled and secure database connections. - [Troubleshooting](accelerate/troubleshoot): When working with Prisma Accelerate, you may encounter errors often highlighted by specific error codes during development and operations. It is important to understand the meaning of these errors, why they occur, and how to resolve them in order to ensure the smooth operation of your applications. This guide aims to provide insights and steps to troubleshoot specific error codes encountered with Prisma Accelerate. - [Get Started](getting-started/index): Get started - [From the CLI](getting-started/prisma-postgres/from-the-cli): This page provides a step-by-step guide for Prisma Postgres after setting it up with prisma init --db: - [Import from existing database](getting-started/prisma-postgres/import-from-existing-database-mysql): This guide provides step-by-step instructions for importing data from an existing MySQL database into Prisma Postgres. - [Import from existing database](getting-started/prisma-postgres/import-from-existing-database-postgresql): This guide provides step-by-step instructions for importing data from an existing PostgreSQL database into Prisma Postgres. - [Prisma Postgres](getting-started/prisma-postgres/index): In this section - [Upgrade from Early Access](getting-started/prisma-postgres/upgrade-from-early-access): This guide shows you how to migrate your Prisma Postgres Early Access (EA) database to the now official Prisma Postgres General Availability (GA) database. Prisma Postgres Early Access was introduced to allow early adopters to test Prisma’s new managed PostgreSQL service. As we move to GA, it's crucial to safely migrate data from your EA database to the new GA database. - [Quickstart](getting-started/quickstart-prismaPostgres): In this Quickstart guide, you'll learn how to get started from scratch with Prisma ORM and a Prisma Postgres database in a plain TypeScript project. It covers the following workflows: - [Quickstart](getting-started/quickstart-sqlite): In this Quickstart guide, you'll learn how to get started with Prisma ORM from scratch using a plain TypeScript project and a local SQLite database file. It covers data modeling, migrations and querying a database. - [Add to existing project](getting-started/setup-prisma/add-to-existing-project/index): Include Prisma ORM in an existing project with the following documentation, which explains some core concepts as it guides you through integrating Prisma ORM into your workflow. - [MongoDB](getting-started/setup-prisma/add-to-existing-project/mongodb-node-mongodb): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to Prisma CLI, Prisma Client, and Prisma Introspection. - [MongoDB](getting-started/setup-prisma/add-to-existing-project/mongodb-typescript-mongodb): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to Prisma CLI, Prisma Client, and Prisma Introspection. - [Connect your database (MongoDB)](getting-started/setup-prisma/add-to-existing-project/mongodb/connect-your-database-node-mongodb): Connecting your database - [Connect your database (MongoDB)](getting-started/setup-prisma/add-to-existing-project/mongodb/connect-your-database-typescript-mongodb): Connecting your database - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/mongodb/install-prisma-client-node-mongodb): Install and generate Prisma Client - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/mongodb/install-prisma-client-typescript-mongodb): Install and generate Prisma Client - [Introspection](getting-started/setup-prisma/add-to-existing-project/mongodb/introspection-node-mongodb): Prisma ORM introspects a MongoDB schema by sampling the data stored in the given database and inferring the schema of that data. - [Introspection](getting-started/setup-prisma/add-to-existing-project/mongodb/introspection-typescript-mongodb): Prisma ORM introspects a MongoDB schema by sampling the data stored in the given database and inferring the schema of that data. - [Next steps](getting-started/setup-prisma/add-to-existing-project/mongodb/next-steps): This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the Introduction page to get a high-level overview of Prisma ORM. - [Querying the database](getting-started/setup-prisma/add-to-existing-project/mongodb/querying-the-database-node-mongodb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/mongodb/querying-the-database-typescript-mongodb): Write your first query with Prisma Client - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-node-cockroachdb): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-node-mysql): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-node-planetscale): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-node-postgresql): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-node-sqlserver): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-cockroachdb): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-mysql): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-planetscale): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgresql): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Relational databases](getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-sqlserver): Learn how to add Prisma ORM to an existing Node.js or TypeScript project by connecting it to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Introspection. - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-node-cockroachdb): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-node-mysql): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-node-postgresql): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-node-sqlserver): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-cockroachdb): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-mysql): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-postgresql): Create an initial migration - [Baseline your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-sqlserver): Create an initial migration - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-node-cockroachdb): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-node-mysql): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-node-planetscale): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-node-postgresql): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-node-sqlserver): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-cockroachdb): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-mysql): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-planetscale): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-postgresql): Connecting your database - [Connect your database](getting-started/setup-prisma/add-to-existing-project/relational-databases/connect-your-database-typescript-sqlserver): Connecting your database - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-node-cockroachdb): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-node-mysql): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-node-postgresql): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-node-sqlserver): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-typescript-cockroachdb): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-typescript-mysql): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-typescript-postgresql): Add a Tag model to your schema - [Evolve your schema](getting-started/setup-prisma/add-to-existing-project/relational-databases/evolve-your-schema-typescript-sqlserver): Add a Tag model to your schema - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-node-cockroachdb): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-node-mysql): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-node-planetscale): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-node-postgresql): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-node-sqlserver): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-typescript-cockroachdb): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-typescript-mysql): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-typescript-planetscale): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-typescript-postgresql): - [Install Prisma Client](getting-started/setup-prisma/add-to-existing-project/relational-databases/install-prisma-client-typescript-sqlserver): - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-node-cockroachdb): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-node-mysql): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-node-planetscale): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-node-postgresql): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-node-sqlserver): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-cockroachdb): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-mysql): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-planetscale): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-postgresql): Introspect your database with Prisma ORM - [Introspection](getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-sqlserver): Introspect your database with Prisma ORM - [Next steps](getting-started/setup-prisma/add-to-existing-project/relational-databases/next-steps): This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the Introduction page to get a high-level overview of Prisma ORM. - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-node-cockroachdb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-node-mysql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-node-planetscale): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-node-postgresql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-node-sqlserver): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-typescript-cockroachdb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-typescript-mysql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-typescript-planetscale): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-typescript-postgresql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/add-to-existing-project/relational-databases/querying-the-database-typescript-sqlserver): Write your first query with Prisma Client - [Set up Prisma ORM](getting-started/setup-prisma/index): Start from scratch or add Prisma ORM to an existing project. The following tutorials introduce you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Start from scratch](getting-started/setup-prisma/start-from-scratch/index): Start a fresh project from scratch with the following tutorials as they introduce you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [MongoDB](getting-started/setup-prisma/start-from-scratch/mongodb-node-mongodb): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your MongoDB database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI and Prisma Client. - [MongoDB](getting-started/setup-prisma/start-from-scratch/mongodb-typescript-mongodb): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your MongoDB database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI and Prisma Client. - [Connect your database (MongoDB)](getting-started/setup-prisma/start-from-scratch/mongodb/connect-your-database-node-mongodb): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database (MongoDB)](getting-started/setup-prisma/start-from-scratch/mongodb/connect-your-database-typescript-mongodb): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Creating the Prisma schema](getting-started/setup-prisma/start-from-scratch/mongodb/creating-the-prisma-schema-node-mongodb): Update the Prisma schema - [Creating the Prisma schema](getting-started/setup-prisma/start-from-scratch/mongodb/creating-the-prisma-schema-typescript-mongodb): Update the Prisma schema - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/mongodb/install-prisma-client-node-mongodb): Install and generate Prisma Client - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/mongodb/install-prisma-client-typescript-mongodb): Install and generate Prisma Client - [Next steps](getting-started/setup-prisma/start-from-scratch/mongodb/next-steps): This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the Introduction page to get a high-level overview of Prisma ORM. - [Querying the database](getting-started/setup-prisma/start-from-scratch/mongodb/querying-the-database-node-mongodb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/mongodb/querying-the-database-typescript-mongodb): Write your first query with Prisma Client - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-node-cockroachdb): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-node-mysql): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-node-planetscale): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-node-postgresql): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-node-sqlserver): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-cockroachdb): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-mysql): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-planetscale): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgresql): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-prismaPostgres): Learn how to create a new TypeScript project with a Prisma Postgres database from scratch. This tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate and covers the following workflows: - [Relational databases](getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-sqlserver): Learn how to create a new Node.js or TypeScript project from scratch by connecting Prisma ORM to your database and generating a Prisma Client for database access. The following tutorial introduces you to the Prisma CLI, Prisma Client, and Prisma Migrate. - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-node-cockroachdb): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-node-mysql): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-node-planetscale): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-node-postgresql): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-node-sqlserver): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-cockroachdb): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-mysql): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-planetscale): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-postgresql): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-prismaPostgres): Set up a Prisma Postgres database in the PDP Console - [Connect your database](getting-started/setup-prisma/start-from-scratch/relational-databases/connect-your-database-typescript-sqlserver): To connect your database, you need to set the url field of the datasource block in your Prisma schema to your database connection URL: - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-node-cockroachdb): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-node-mysql): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-node-planetscale): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-node-postgresql): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-node-sqlserver): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-cockroachdb): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-mysql): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-planetscale): - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-postgresql): These commands serve different purposes in managing your database schema with Prisma. Here’s a breakdown of when and why to use each: - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-prismaPostgres): Install the Prisma Accelerate extension - [Install Prisma Client](getting-started/setup-prisma/start-from-scratch/relational-databases/install-prisma-client-typescript-sqlserver): - [Next steps](getting-started/setup-prisma/start-from-scratch/relational-databases/next-steps): This section lists a number of potential next steps you can now take from here. Feel free to explore these or read the Introduction page to get a high-level overview of Prisma ORM. - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-node-cockroachdb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-node-mysql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-node-planetscale): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-node-postgresql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-node-sqlserver): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-cockroachdb): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-mysql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-planetscale): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-postgresql): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-prismaPostgres): Write your first query with Prisma Client - [Querying the database](getting-started/setup-prisma/start-from-scratch/relational-databases/querying-the-database-typescript-sqlserver): Write your first query with Prisma Client - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-node-cockroachdb): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-node-mysql): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-node-planetscale): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-node-postgresql): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-node-sqlserver): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-cockroachdb): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-mysql): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-planetscale): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-postgresql): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-prismaPostgres): Creating the database schema - [Using Prisma Migrate](getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-sqlserver): Creating the database schema - [How to use Prisma ORM with Clerk Auth and Next.js](guides/clerk-nextjs): Learn how to use Prisma ORM in a Next.js app with Clerk Auth - [How to use Prisma ORM with Cloudflare D1](guides/cloudflare-d1): Learn how to use Prisma ORM with Cloudflare D1 - [How to set up Datadog tracing with Prisma ORM](guides/data-dog): Learn how to configure Datadog tracing for a Prisma ORM project. Capture spans for every query using the @prisma/instrumentation package, dd-trace, and view them in Datadog. - [Migrate data using the expand and contract pattern](guides/data-migration): Learn how to perform data migrations using the expand and contract pattern with Prisma ORM - [How to use Prisma in Docker](guides/docker): Learn step-by-step configure a Prisma ORM app in Docker - [How to manage schema changes in a team](guides/implementing-schema-changes): Learn how to use Prisma Migrate effectively when collaborating on a project as a team - [Guides](guides/index): Welcome to the Guides section! Here you'll find practical, step-by-step guides to help you accomplish specific tasks with Prisma products, including Prisma ORM, Prisma Accelerate, Prisma Postgres, and more. - [How to write guides for Prisma ORM](guides/making-guides): Learn how to write clear, consistent, and helpful guides for Prisma ORM documentation - [How to migrate from Drizzle to Prisma ORM](guides/migrate-from-drizzle): Learn how to migrate from Drizzle to Prisma ORM - [How to migrate from Mongoose to Prisma ORM](guides/migrate-from-mongoose): Learn how to migrate from Mongoose to Prisma ORM - [How to migrate from Sequelize to Prisma ORM](guides/migrate-from-sequelize): Learn how to migrate from Sequelize to Prisma ORM - [How to migrate from TypeORM to Prisma ORM](guides/migrate-from-typeorm): Learn how to migrate from TypeORM to Prisma ORM - [How to use multiple databases in a single app](guides/multiple-databases): Learn how to use multiple Prisma Clients in a single app to connect to multiple databases, handle migrations, and deploy your application to Vercel. - [How to use Prisma ORM with Next.js](guides/nextjs): Learn how to use Prisma ORM in a Next.js app and deploy it to Vercel - [How to use Prisma ORM with Nuxt](guides/nuxt): A step-by-step guide to setting up and using Prisma ORM and Prisma Postgres with the Prisma Nuxt module and deploying to Vercel. - [How to use Prisma ORM with React Router 7](guides/react-router-7): Learn how to use Prisma ORM and Prisma Postgres in a React Router 7 app. - [How to use Prisma ORM with SolidStart](guides/solid-start): Learn how to use Prisma ORM in a SolidStart app - [How to use Prisma ORM with SvelteKit](guides/sveltekit): Learn how to use Prisma ORM in a SvelteKit app - [How to use Prisma ORM with TanStack Start](guides/tanstack-start): Learn how to use Prisma ORM in a TanStack Start app - [How to use Prisma ORM with Turborepo](guides/turborepo): Learn step-by-step how to integrate Prisma ORM with Turborepo to build modular, scalable monorepo architectures efficiently. - [How to use Prisma ORM in a pnpm workspaces monorepo](guides/use-prisma-in-pnpm-workspaces): Learn step-by-step how to integrate Prisma ORM in a pnpm workspaces monorepo to build scalable and modular applications efficiently. - [FAQ](optimize/faq): To learn more about frequently asked questions around Prisma Optimize and query recommendations, visit this page. - [Getting Started](optimize/getting-started): Prerequisites - [](optimize/index): Prisma Optimize - [Known limitations](optimize/known-limitations): Below are the known limitations when using Prisma Optimize. If you are aware of any limitations that are missing, please let us know on the #help-and-questions channel in our community Discord. - [Performance metrics](optimize/performance-metrics): An Optimize recording session provides detailed insights into the latencies of executed queries, capturing key metrics such as average duration, 50th percentile, 99th percentile, and maximal query execution time. - [Prisma AI](optimize/prisma-ai): Prisma AI enables you to ask follow-up questions on a provided recommendation for additional clarity. Learn more about Prisma AI here. - [Recommendations](optimize/recommendations): Optimize provides recommendations focused on performance improvements such as indexing issues, excessive data retrieval, and inefficient query patterns. Recommendations include: - [Recordings](optimize/recordings): The recordings feature helps developers debug and isolate sets of queries into distinct sessions, known as recordings. This targeted approach enables precise performance analysis and optimization by preventing the mixing of queries from different applications or test rounds, leading to clearer insights and more effective debugging. - [Cursor](orm/more/ai-tools/cursor): Cursor is an AI-powered code editor designed to boost productivity by automating repetitive coding tasks. When paired with Prisma, a robust and type-safe toolkit for database workflows, it becomes a powerful solution for managing and optimizing database schemas, queries, and data seeding. - [AI tools](orm/more/ai-tools/index): In this section - [Tabnine](orm/more/ai-tools/tabnine): Tabnine is a an AI software development platform that comes as an extension for your IDE (e.g. VS Code, WebStorm, IntelliJ, ...). - [Windsurf](orm/more/ai-tools/windsurf): Windsurf Editor is an AI-powered code editor designed to boost productivity by automating repetitive coding tasks. When paired with Prisma, a robust and type-safe toolkit for database workflows, it becomes a powerful solution for managing and optimizing database schemas, queries, and data seeding. - [Comparing Prisma ORM](orm/more/comparisons/index): Find out how Prisma ORM compares to ORMs and ODMs in the Node.js and TypeScript ecosystem. - [Drizzle](orm/more/comparisons/prisma-and-drizzle): Prisma and Drizzle take different approaches to working with databases. While Drizzle appeals to developers who prefer writing queries close to SQL, Prisma is designed to support teams building and maintaining production applications—where clarity, collaboration, and long-term maintainability matter. - [Mongoose](orm/more/comparisons/prisma-and-mongoose): This page compares the Prisma ORM and Mongoose APIs. If you want to learn how to migrate from Mongoose to Prisma, check out this guide. - [Sequelize](orm/more/comparisons/prisma-and-sequelize): This page compares the Prisma ORM and Sequelize APIs. - [TypeORM](orm/more/comparisons/prisma-and-typeorm): This page compares Prisma ORM and TypeORM. If you want to learn how to migrate from TypeORM to Prisma ORM, check out this guide. - [Editor setup](orm/more/development-environment/editor-setup): This page describes how you can configure your editor for an optimal developer experience when using Prisma ORM. - [Managing Prisma ORM environment variables and settings](orm/more/development-environment/environment-variables): An environment variable is a key value pair of string data that is stored on your machine's local environment. Refer to our Environment variables reference documentation for specific details. - [Development environment](orm/more/development-environment/index): This section describes using env variables, editors, and workspaces in your development environment. - [Autocompletion in GraphQL resolvers with JavaScript](orm/more/help-and-troubleshooting/autocompletion-in-graphql-resolvers-with-js): Problem - [Data validation with CHECK constraints (PostgreSQL)](orm/more/help-and-troubleshooting/check-constraints): Overview - [Compare columns of the same table with raw queries](orm/more/help-and-troubleshooting/comparing-columns-through-raw-queries): Comparing different columns from the same table is a common scenario that developers encounter. Some examples include comparing two numeric values in the same table or comparing two dates in a same table. There's an existing GitHub Issue regarding the same. - [Converting Implicit many-to-many relation to Explicit many-to-many relation](orm/more/help-and-troubleshooting/implicit-to-explicit-conversion): Problem - [Help articles](orm/more/help-and-troubleshooting/index): This section provides a number of common problems that developers might encounter when using Prisma ORM and provides short, practical solutions to resolve them. - [Netlify build dependency caching workaround](orm/more/help-and-troubleshooting/netlify-caching-issue): Problem - [Comprehensive Guide to Using Prisma ORM with Next.js](orm/more/help-and-troubleshooting/nextjs-help): Learn best practices, monorepo strategies, and dynamic usage techniques for Prisma ORM in Next.js applications. - [Solve package error with vercel/pkg](orm/more/help-and-troubleshooting/pkg-issue): Problem - [Using the Nuxt Prisma Module](orm/more/help-and-troubleshooting/prisma-nuxt-module): The Nuxt Prisma module simplifies the integration of Prisma ORM into your Nuxt applications. - [Vercel build dependency caching workaround](orm/more/help-and-troubleshooting/vercel-caching-issue): Problem - [Modeling and querying many-to-many relations](orm/more/help-and-troubleshooting/working-with-many-to-many-relations): Problem - [More](orm/more/index): In this section - [ORM releases and maturity levels](orm/more/releases): This page explains the release process of Prisma ORM, how it's versioned and how to deal with breaking changes that might happen throughout releases. - [Engines](orm/more/under-the-hood/engines): From a technical perspective, Prisma Client consists of three major components: - [Under the hood](orm/more/under-the-hood/index): This page gives an overview of the Prisma ORM internals and how it works "under the hood". - [Upgrade guides](orm/more/upgrade-guides/index): In this section - [How to upgrade](orm/more/upgrade-guides/upgrade-from-prisma-1/how-to-upgrade): Overview - [Upgrade from Prisma 1](orm/more/upgrade-guides/upgrade-from-prisma-1/index): In this section - [Schema incompatibilities](orm/more/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-mysql): Overview - [Schema incompatibilities](orm/more/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgresql): Overview - [Upgrade from MongoDB Beta](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrade-from-mongodb-beta): Introduction - [REST API](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-a-rest-api): Overview - [Old to new Nexus](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-nexus-prisma-to-nexus): Overview - [prisma-binding to Nexus](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-nexus): Overview - [prisma-binding to SDL-first](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-sdl-first): Overview - [Upgrading the Prisma ORM layer](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-the-prisma-layer-mysql): Overview - [Upgrading the Prisma ORM layer](orm/more/upgrade-guides/upgrade-from-prisma-1/upgrading-the-prisma-layer-postgresql): Overview - [Upgrading to use Preview features](orm/more/upgrade-guides/upgrading-to-use-preview-features): Preview features are new features that can only be used by opting in using a corresponding feature flag. - [Codemods](orm/more/upgrade-guides/upgrading-versions/codemods): The @prisma/codemods package helps you to upgrade your codebase as Prisma ORM evolves. - [Upgrading versions](orm/more/upgrade-guides/upgrading-versions/index): To upgrade to the latest version of Prisma ORM: - [Upgrade to Prisma ORM 3](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/index): Prisma ORM 3 introduces a number of breaking changes if you are upgrading from an earlier version (any 2.x version), therefore, it is important to understand how this upgrade might affect your application and make any needed adjustments to ensure a smooth transition. - [Named constraints upgrade path](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/named-constraints): After upgrading to Prisma ORM 3, the default naming convention for constraint and index names will change and your primary and foreign key names will now be part of the schema for databases that support them. Therefore the meaning of your existing Prisma schema will change. - [Referential actions upgrade path](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-3/referential-actions): Prisma ORM version 2.x prevents deletion of connected records in some Prisma Client functions, and does not let you configure referential actions in your Prisma Schema to change that behavior. - [Upgrade to Prisma ORM 4](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-4): Prisma ORM 4 introduces a number of breaking changes when you upgrade from an earlier Prisma ORM version. This guide explains how this upgrade might affect your application and gives instructions on how to handle any changes. - [Upgrade to Prisma ORM 5](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-5/index): Prisma ORM 5.0.0 introduces a number of changes, including the usage of our new JSON Protocol, which make Prisma Client faster by default. A full list of these changes can be found in our release notes. - [jsonProtocol changes](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-5/jsonprotocol-changes): As of Prisma ORM version 5.0.0, the new jsonProtocol is the default. There are some changes that directly result from this change and a few changes that are related to the new protocol. - [rejectOnNotFound changes](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-5/rejectonnotfound-changes): As of Prisma ORM version 5.0.0, the deprecated parameter rejectOnNotFound has been removed. Depending on if your project used rejectOnNotFound per query or globally, there will be be different ways of updating your code. - [Upgrade to Prisma ORM 6](orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-6): Prisma ORM v6 introduces a number of breaking changes when you upgrade from an earlier Prisma ORM version. This guide explains how this upgrade might affect your application and gives instructions on how to handle any changes. - [ORM](orm/orm-index): Prisma ORM is a Node.js and TypeScript ORM with an intuitive data model, automated migrations, type-safety, and auto-completion. - [Beyond Prisma ORM](orm/overview/beyond-prisma-orm): Prisma ORM addresses many development needs, but Prisma's additional products like Prisma Postgres, Accelerate and Optimize can further enhance scalability and performance for your applications. - [Cloudflare D1](orm/overview/databases/cloudflare-d1): This page discusses the concepts behind using Prisma ORM and Cloudflare D1, explains the commonalities and differences between Cloudflare D1 and other database providers, and leads you through the process for configuring your application to integrate with Cloudflare D1. - [CockroachDB](orm/overview/databases/cockroachdb): This guide discusses the concepts behind using Prisma ORM and CockroachDB, explains the commonalities and differences between CockroachDB and other database providers, and leads you through the process for configuring your application to integrate with CockroachDB. - [Database drivers](orm/overview/databases/database-drivers): Default built-in drivers - [Databases](orm/overview/databases/index): Learn about the different databases Prisma ORM supports. - [MongoDB](orm/overview/databases/mongodb): This guide discusses the concepts behind using Prisma ORM and MongoDB, explains the commonalities and differences between MongoDB and other database providers, and leads you through the process for configuring your application to integrate with MongoDB using Prisma ORM. - [MySQL/MariaDB](orm/overview/databases/mysql): The MySQL data source connector connects Prisma ORM to a MySQL or MariaDB database server. - [Neon](orm/overview/databases/neon): This guide explains how to: - [PlanetScale](orm/overview/databases/planetscale): Prisma and PlanetScale together provide a development arena that optimizes rapid, type-safe development of data access applications, using Prisma's ORM and PlanetScale's highly scalable MySQL-based platform. - [PostgreSQL](orm/overview/databases/postgresql): The PostgreSQL data source connector connects Prisma ORM to a PostgreSQL database server. - [Microsoft SQL Server](orm/overview/databases/sql-server/index): The Microsoft SQL Server data source connector connects Prisma ORM to a Microsoft SQL Server database server. - [SQL Server on Docker](orm/overview/databases/sql-server/sql-server-docker): To run a Microsoft SQL Server container image with Docker: - [SQL Server on Windows (local)](orm/overview/databases/sql-server/sql-server-local): To run a Microsoft SQL Server locally on a Windows machine: - [SQLite](orm/overview/databases/sqlite): The SQLite data source connector connects Prisma ORM to a SQLite database file. These files always have the file ending .db (e.g.: dev.db). - [Supabase](orm/overview/databases/supabase): This guide discusses the concepts behind using Prisma ORM and Supabase, explains the commonalities and differences between Supabase and other database providers, and leads you through the process for configuring your application to integrate with Supabase. - [Turso](orm/overview/databases/turso): This guide discusses the concepts behind using Prisma ORM and Turso, explains the commonalities and differences between Turso and other database providers, and leads you through the process for configuring your application to integrate with Turso. - [Overview](orm/overview/index): In this section - [Data modeling](orm/overview/introduction/data-modeling): What is data modeling? - [Introduction](orm/overview/introduction/index): This page gives a high-level overview of what Prisma ORM is and how it works. - [Should you use Prisma ORM?](orm/overview/introduction/should-you-use-prisma): Prisma ORM is a new kind of ORM that - like any other tool - comes with its own tradeoffs. This page explains when Prisma ORM would be a good fit, and provides alternatives for other scenarios. - [What is Prisma ORM?](orm/overview/introduction/what-is-prisma): Prisma ORM is an open-source next-generation ORM. It consists of the following parts: - [Why Prisma ORM?](orm/overview/introduction/why-prisma): On this page, you'll learn about the motivation for Prisma ORM and how it compares to other database tools like traditional ORMs and SQL query builders. - [Fullstack](orm/overview/prisma-in-your-stack/fullstack): Fullstack frameworks, such as Next.js, Remix or SvelteKit, blur the lines between the server and the client. These frameworks also provide different patterns for fetching and mutating data on the server. - [GraphQL](orm/overview/prisma-in-your-stack/graphql): GraphQL is a query language for APIs. It is often used as an alternative to RESTful APIs, but can also be used as an additional "gateway" layer on top of existing RESTful services. - [Prisma ORM in your stack](orm/overview/prisma-in-your-stack/index): Prisma ORM provides a fully type-safe API and simplified database access. You can use Prisma ORM tools to build a GraphQL or REST API, or as part of a fullstack application - the extent to which you incorporate Prisma ORM is up to you. - [Is Prisma ORM an ORM?](orm/overview/prisma-in-your-stack/is-prisma-an-orm): To answer the question briefly: Yes, Prisma ORM is a new kind of ORM that fundamentally differs from traditional ORMs and doesn't suffer from many of the problems commonly associated with these. - [REST](orm/overview/prisma-in-your-stack/rest): When building REST APIs, Prisma Client can be used inside your route controllers to send databases queries. - [`client`: Add methods to Prisma Client](orm/prisma-client/client-extensions/client): Prisma Client extensions are Generally Available from versions 4.16.0 and later. They were introduced in Preview in version 4.7.0. Make sure you enable the clientExtensions Preview feature flag if you are running on a version earlier than 4.16.0. - [Shared packages & examples](orm/prisma-client/client-extensions/extension-examples): Extensions made by Prisma - [Extensions](orm/prisma-client/client-extensions/index): Prisma Client extensions are Generally Available from versions 4.16.0 and later. They were introduced in Preview in version 4.7.0. Make sure you enable the clientExtensions Preview feature flag if you are running on a version earlier than 4.16.0. - [Middleware](orm/prisma-client/client-extensions/middleware/index): Deprecated: Middleware is deprecated in version 4.16.0. - [Middleware sample: logging](orm/prisma-client/client-extensions/middleware/logging-middleware): The following example logs the time taken for a Prisma Client query to run: - [Middleware sample: session data](orm/prisma-client/client-extensions/middleware/session-data-middleware): The following example sets the language field of each Post to the context language (taken, for example, from session state): - [Middleware sample: soft delete](orm/prisma-client/client-extensions/middleware/soft-delete-middleware): The following sample uses middleware to perform a soft delete. Soft delete means that a record is marked as deleted by changing a field like deleted to true rather than actually being removed from the database. Reasons to use a soft delete include: - [`model`: Add custom methods to your models](orm/prisma-client/client-extensions/model): Prisma Client extensions are Generally Available from versions 4.16.0 and later. They were introduced in Preview in version 4.7.0. Make sure you enable the clientExtensions Preview feature flag if you are running on a version earlier than 4.16.0. - [`query`: Create custom Prisma Client queries](orm/prisma-client/client-extensions/query): Prisma Client extensions are Generally Available from versions 4.16.0 and later. They were introduced in Preview in version 4.7.0. Make sure you enable the clientExtensions Preview feature flag if you are running on a version earlier than 4.16.0. - [`result`: Add custom fields and methods to query results](orm/prisma-client/client-extensions/result): Prisma Client extensions are Generally Available from versions 4.16.0 and later. They were introduced in Preview in version 4.7.0. Make sure you enable the clientExtensions Preview feature flag if you are running on a version earlier than 4.16.0. - [Shared Prisma Client extensions](orm/prisma-client/client-extensions/shared-extensions): You can share your Prisma Client extensions with other users, either as packages or as modules, and import extensions that other users create into your project. - [Type utilities](orm/prisma-client/client-extensions/type-utilities): Several type utilities exist within Prisma Client that can assist in the creation of highly type-safe extensions. - [Debugging](orm/prisma-client/debugging-and-troubleshooting/debugging): You can enable debugging output in Prisma Client and Prisma CLI via the DEBUG environment variable. It accepts two namespaces to print debugging output: - [Handling exceptions and errors](orm/prisma-client/debugging-and-troubleshooting/handling-exceptions-and-errors): In order to handle different types of errors you can use instanceof to check what the error is and handle it accordingly. - [Debugging & troubleshooting](orm/prisma-client/debugging-and-troubleshooting/index): Prisma Optimize helps you generate insights and provides recommendations that can help you make your database queries faster: - [Caveats when deploying to AWS platforms](orm/prisma-client/deployment/caveats-when-deploying-to-aws-platforms): The following describes some caveats you might face when deploying to different AWS platforms. - [Deploying database changes with Prisma Migrate](orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate): To apply pending migrations to staging, testing, or production environments, run the migrate deploy command as part of your CI/CD pipeline: - [Deploy migrations from a local environment](orm/prisma-client/deployment/deploy-migrations-from-a-local-environment): There are two scenarios where you might consider deploying migrations directly from a local environment to a production environment. - [Deploy Prisma ORM](orm/prisma-client/deployment/deploy-prisma): Projects using Prisma Client can be deployed to many different cloud platforms. Given the variety of cloud platforms and different names, it's noteworthy to mention the different deployment paradigms, as they affect the way you deploy an application using Prisma Client. - [Deploy to a different OS](orm/prisma-client/deployment/deploy-to-a-different-os): Prisma Client depends on the query engine that is running as a binary on the same host as your application. - [Deploy to Cloudflare Workers & Pages](orm/prisma-client/deployment/edge/deploy-to-cloudflare): This page covers everything you need to know to deploy an app with Prisma ORM to a Cloudflare Worker or to Cloudflare Pages. - [Deploy to Deno Deploy](orm/prisma-client/deployment/edge/deploy-to-deno-deploy): With this guide, you can learn how to build and deploy a simple application to Deno Deploy. The application uses Prisma ORM to save a log of each request to a Prisma Postgres database. - [Deploy to Vercel Edge Functions & Middleware](orm/prisma-client/deployment/edge/deploy-to-vercel): This page covers everything you need to know to deploy an app that uses Prisma Client for talking to a database in Vercel Edge Middleware or a Vercel Function deployed to the Vercel Edge Runtime. - [Edge functions](orm/prisma-client/deployment/edge/index): If your application is deployed via an "Edge Function" offering or is deployed from a serverless offering and has a non-standard runtime, it is a edge-deployed app. Common examples for such offerings include Cloudflare Workers or Pages, Vercel Edge Functions or Edge Middleware, and Deno Deploy. - [Deploying edge functions with Prisma ORM](orm/prisma-client/deployment/edge/overview): You can deploy an application that uses Prisma ORM to the edge. Depending on which edge function provider and which database you use, there are different considerations and things to be aware of. - [Deployment](orm/prisma-client/deployment/index): This section describes how to deploy Node.js applications that use Prisma Client and TypeScript to various platforms. - [Module bundlers](orm/prisma-client/deployment/module-bundlers): Overview - [Deploy to AWS Lambda](orm/prisma-client/deployment/serverless/deploy-to-aws-lambda): This guide explains how to avoid common issues when deploying a project using Prisma ORM to AWS Lambda. - [Deploy to Azure Functions](orm/prisma-client/deployment/serverless/deploy-to-azure-functions): This guide explains how to avoid common issues when deploying a Node.js-based function app to Azure using Azure Functions. - [Deploy to Netlify](orm/prisma-client/deployment/serverless/deploy-to-netlify): This guide covers the steps you will need to take in order to deploy your application that uses Prisma ORM to Netlify. - [Deploy to Vercel](orm/prisma-client/deployment/serverless/deploy-to-vercel): This guide takes you through the steps to set up and deploy a serverless application that uses Prisma to Vercel. - [Serverless functions](orm/prisma-client/deployment/serverless/index): If your application is deployed via a "Serverless Function" or "Function-as-a-Service (FaaS)" offering and uses a standard Node.js runtime, it is a serverless app. Common deployment examples include AWS Lambda and Vercel Serverless Functions. - [Deploy to Fly.io](orm/prisma-client/deployment/traditional/deploy-to-flyio): This guide explains how to deploy a Node.js server that uses Prisma ORM and PostgreSQL to Fly.io. - [Deploy to Heroku](orm/prisma-client/deployment/traditional/deploy-to-heroku): In this guide, you will set up and deploy a Node.js server that uses Prisma ORM with PostgreSQL to Heroku. The application exposes a REST API and uses Prisma Client to handle fetching, creating, and deleting records from a database. - [Deploy to Koyeb](orm/prisma-client/deployment/traditional/deploy-to-koyeb): In this guide, you will set up and deploy a Node.js server that uses Prisma ORM with PostgreSQL to Koyeb. The application exposes a REST API and uses Prisma Client to handle fetching, creating, and deleting records from a database. - [Deploy to Render](orm/prisma-client/deployment/traditional/deploy-to-render): This guide explains how to deploy a Node.js server that uses Prisma ORM and PostgreSQL to Render. - [Traditional servers](orm/prisma-client/deployment/traditional/index): If your application is deployed via a Platform-as-a-Service (PaaS) provider, whether containerized or not, it is a traditionally-deployed app. Common deployment examples include Heroku and Koyeb. - [Prisma Client](orm/prisma-client/index): In this section - [Observability & logging](orm/prisma-client/observability-and-logging/index): In this section - [Logging](orm/prisma-client/observability-and-logging/logging): Use the PrismaClient log parameter to configure log levels , including warnings, errors, and information about the queries sent to the database. - [Metrics](orm/prisma-client/observability-and-logging/metrics): Prisma Client metrics give you a detailed insight into how Prisma Client interacts with your database. You can use this insight to help diagnose performance issues with your application. - [OpenTelemetry tracing](orm/prisma-client/observability-and-logging/opentelemetry-tracing): Tracing provides a detailed log of the activity that Prisma Client carries out, at an operation level, including the time taken to execute each query. It helps you analyze your application's performance and identify bottlenecks. Tracing is fully compliant with OpenTelemetry, so you can use it as part of your end-to-end application tracing system. - [Aggregation, grouping, and summarizing](orm/prisma-client/queries/aggregation-grouping-summarizing): Prisma Client allows you to count records, aggregate number fields, and select distinct field values. - [Case sensitivity](orm/prisma-client/queries/case-sensitivity): Case sensitivity affects filtering and sorting of data, and is determined by your database collation. Sorting and filtering data yields different results depending on your settings: - [Computed fields](orm/prisma-client/queries/computed-fields): Computed fields allow you to derive a new field based on existing data. A common example is when you want to compute a full name. In your database, you may only store the first and last name, but you can define a function that computes a full name by combining the first and last name. Computed fields are read-only and stored in your application's memory, not in your database. - [CRUD](orm/prisma-client/queries/crud): This page describes how to perform CRUD operations with your generated Prisma Client API. CRUD is an acronym that stands for: - [Custom models](orm/prisma-client/queries/custom-models): As your application grows, you may find the need to group related logic together. We suggest either: - [Custom validation](orm/prisma-client/queries/custom-validation): You can add runtime validation for your user input for Prisma Client queries in one of the following ways: - [Excluding fields](orm/prisma-client/queries/excluding-fields): By default Prisma Client returns all fields from a model. You can use select to narrow the result set, but that can be unwieldy if you have a large model and you only want to exclude a small number of fields. - [Filtering and Sorting](orm/prisma-client/queries/filtering-and-sorting): Prisma Client supports filtering with the where query option, and sorting with the orderBy query option. - [Full-text search](orm/prisma-client/queries/full-text-search): Prisma Client supports full-text search for PostgreSQL databases in versions 2.30.0 and later, and MySQL databases in versions 3.8.0 and later. With full-text search (FTS) enabled, you can add search functionality to your application by searching for text within a database column. - [Queries](orm/prisma-client/queries/index): In this section - [Pagination](orm/prisma-client/queries/pagination): Prisma Client supports both offset pagination and cursor-based pagination. - [Query optimization](orm/prisma-client/queries/query-optimization-performance): This guide shows how to identify and optimize query performance, debug performance issues, and address common challenges. - [Relation queries](orm/prisma-client/queries/relation-queries): A key feature of Prisma Client is the ability to query relations between two or more models. Relation queries include: - [Select fields](orm/prisma-client/queries/select-fields): Overview - [Transactions and batch queries](orm/prisma-client/queries/transactions): A database transaction refers to a sequence of read/write operations that are guaranteed to either succeed or fail as a whole. This section describes the ways in which the Prisma Client API supports transactions. - [Custom model and field names](orm/prisma-client/setup-and-configuration/custom-model-and-field-names): The Prisma Client API is generated based on the models in your Prisma schema. Models are typically 1:1 mappings of your database tables. - [Database polyfills](orm/prisma-client/setup-and-configuration/database-polyfills): Prisma Client provides features that are typically either not achievable with particular databases or require extensions. These features are referred to as polyfills. For all databases, this includes: - [Connection management](orm/prisma-client/setup-and-configuration/databases-connections/connection-management): PrismaClient connects and disconnects from your data source using the following two methods: - [Connection pool](orm/prisma-client/setup-and-configuration/databases-connections/connection-pool): The query engine manages a connection pool of database connections. The pool is created when Prisma Client opens the first connection to the database, which can happen in one of two ways: - [Database connections](orm/prisma-client/setup-and-configuration/databases-connections/index): Databases can handle a limited number of concurrent connections. Each connection requires RAM, which means that simply increasing the database connection limit without scaling available resources: - [Configure Prisma Client with PgBouncer](orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer): An external connection pooler like PgBouncer holds a connection pool to the database, and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time. - [Configuring error formatting](orm/prisma-client/setup-and-configuration/error-formatting): By default, Prisma Client uses ANSI escape characters to pretty print the error stack and give recommendations on how to fix a problem. While this is very useful when using Prisma Client from the terminal, in contexts like a GraphQL API, you only want the minimal error without any additional formatting. - [Generating Prisma Client](orm/prisma-client/setup-and-configuration/generating-prisma-client): Prisma Client is a generated database client that's tailored to your database schema. By default, Prisma Client is generated into the node_modules/.prisma/client folder, but we highly recommend you specify an output location. - [Setup & configuration](orm/prisma-client/setup-and-configuration/index): This section describes how to set up, generate, configure, and instantiate PrismaClient , as well as when and how to actively manage connections. - [Instantiating Prisma Client](orm/prisma-client/setup-and-configuration/instantiate-prisma-client): The following example demonstrates how to import and instantiate your generated client from the default path: - [Introduction](orm/prisma-client/setup-and-configuration/introduction): Prisma Client is an auto-generated and type-safe query builder that's tailored to your data. The easiest way to get started with Prisma Client is by following the Quickstart. - [No Rust engine](orm/prisma-client/setup-and-configuration/no-rust-engine): As of v6.7.0, you can use Prisma ORM without Rust engine binaries on SQLite or PostgreSQL databases. - [Read replicas](orm/prisma-client/setup-and-configuration/read-replicas): Read replicas enable you to distribute workloads across database replicas for high-traffic workloads. The read replicas extension, @prisma/extension-read-replicas, adds support for read-only database replicas to Prisma Client. - [Composite types](orm/prisma-client/special-fields-and-types/composite-types): Composite types are only available with MongoDB. - [Fields & types](orm/prisma-client/special-fields-and-types/index): This section covers various special fields and types you can use with Prisma Client. - [Null and undefined](orm/prisma-client/special-fields-and-types/null-and-undefined): In Prisma ORM, if undefined is passed as a value, it is not included in the generated query. This behavior can lead to unexpected results and data loss. In order to prevent this, we strongly recommend updating to version 5.20.0 or later to take advantage of the new strictUndefinedChecks Preview feature, described below. - [Working with compound IDs and unique constraints](orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints): Composite IDs and compound unique constraints can be defined in your Prisma schema using the @@id and @@unique attributes. - [Working with Json fields](orm/prisma-client/special-fields-and-types/working-with-json-fields): Use the Json Prisma ORM field type to read, write, and perform basic filtering on JSON types in the underlying database. In the following example, the User model has an optional Json field named extendedPetsData: - [Working with scalar lists](orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays): Scalar lists are represented by the [] modifier and are only available if the underlying database supports scalar lists. The following example has one scalar String list named pets: - [Testing](orm/prisma-client/testing/index): This section describes how to approach testing an application that uses Prisma Client. - [Integration testing](orm/prisma-client/testing/integration-testing): Integration tests focus on testing how separate parts of the program work together. In the context of applications using a database, integration tests usually require a database to be available and contain data that is convenient to the scenarios intended to be tested. - [Unit testing](orm/prisma-client/testing/unit-testing): Unit testing aims to isolate a small portion (unit) of code and test it for logically predictable behaviors. It generally involves mocking objects or server responses to simulate real world behaviors. Some benefits to unit testing include: - [Type safety](orm/prisma-client/type-safety/index): The generated code for Prisma Client contains several helpful types and utilities that you can use to make your application more type-safe. This page describes patterns for leveraging them. - [Operating against partial structures of your model types](orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types): When using Prisma Client, every model from your Prisma schema is translated into a dedicated TypeScript type. For example, assume you have the following User and Post models: - [How to use Prisma ORM's type system](orm/prisma-client/type-safety/prisma-type-system): This guide introduces Prisma ORM's type system and explains how to introspect existing native types in your database, and how to use types when you apply schema changes to your database with Prisma Migrate or db push. - [Prisma validator](orm/prisma-client/type-safety/prisma-validator): The Prisma.validator is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields. - [Write your own SQL](orm/prisma-client/using-raw-sql/index): While the Prisma Client API aims to make all your database queries intuitive, type-safe, and convenient, there may still be situations where raw SQL is the best tool for the job. - [Raw queries](orm/prisma-client/using-raw-sql/raw-queries): With Prisma ORM 5.19.0, we have released TypedSQL. TypedSQL is a new way to write SQL queries that are type-safe and even easier to add to your workflow. - [SafeQL & Prisma Client](orm/prisma-client/using-raw-sql/safeql): Overview - [TypedSQL](orm/prisma-client/using-raw-sql/typedsql): Getting started with TypedSQL - [Getting started with Prisma Migrate](orm/prisma-migrate/getting-started): This page explains how to get started with migrating your schema in a development environment using Prisma Migrate. - [Prisma Migrate](orm/prisma-migrate/index): In this section - [Understanding Prisma Migrate](orm/prisma-migrate/understanding-prisma-migrate/index): In this section - [Legacy Prisma Migrate](orm/prisma-migrate/understanding-prisma-migrate/legacy-migrate): Important! This page documents legacy Prisma Migrate (Experimental) available in version 2.12.0 and earlier. Prisma Migrate is available in version 2.13.0 and Generally Available in 2.19.0. - [Limitations and known issues](orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues): The following limitations apply to Prisma Migrate. - [Mental model](orm/prisma-migrate/understanding-prisma-migrate/mental-model): This guide provides a conceptual overview of database migrations using Prisma Migrate when working with relational databases. It covers: what database migrations are, their value, and what Prisma Migrate is and how you can evolve your database schema with Prisma Migrate in different environments. - [About migration histories](orm/prisma-migrate/understanding-prisma-migrate/migration-histories): This page explains how Prisma ORM uses migration histories to track changes to your schema. - [Overview](orm/prisma-migrate/understanding-prisma-migrate/overview): Does not apply for MongoDBInstead of migrate dev and related commands, use db push for MongoDB. - [About the shadow database](orm/prisma-migrate/understanding-prisma-migrate/shadow-database): The shadow database is a second, temporary database that is created and deleted automatically\ each time you run prisma migrate dev and is primarily used to detect problems* such as schema drift or potential data loss of the generated migration. - [Baselining a database](orm/prisma-migrate/workflows/baselining): Baselining is the process of initializing a migration history for a database that: - [Customizing migrations](orm/prisma-migrate/workflows/customizing-migrations): This guide does not apply for MongoDB. - [Data migrations](orm/prisma-migrate/workflows/data-migration): This guide has been moved to our new guides section. You can find the guide there. - [Development and production](orm/prisma-migrate/workflows/development-and-production): This page explains how to use Prisma Migrate commands in development and production environments. - [Generating down migrations](orm/prisma-migrate/workflows/generating-down-migrations): This guide describes how to generate a down migration SQL file that reverses a given migration file. - [Workflows](orm/prisma-migrate/workflows/index): In this section - [Native database functions](orm/prisma-migrate/workflows/native-database-functions): In PostgreSQL, some native database functions are part of optional extensions. For example, in PostgreSQL versions 12.13 and earlier the genrandomuuid() function is part of the pgcrypto extension. - [Native database types](orm/prisma-migrate/workflows/native-database-types): Prisma Migrate translates the model defined in your Prisma schema into features in your database. - [Patching & hotfixing](orm/prisma-migrate/workflows/patching-and-hotfixing): Patching or hotfixing a database involves making an often time critical change directly in production. For example, you might add an index directly to a production database to resolve an issue with a slow-running query. - [Prototyping your schema](orm/prisma-migrate/workflows/prototyping-your-schema): The Prisma CLI has a dedicated command for prototyping schemas: db push - [Seeding](orm/prisma-migrate/workflows/seeding): This guide describes how to seed your database using Prisma Client and Prisma ORM's integrated seeding functionality. Seeding allows you to consistently re-create the same data in your database and can be used to: - [Squashing migrations](orm/prisma-migrate/workflows/squashing-migrations): This guide describes how to squash multiple migration files into a single migration. - [Team development](orm/prisma-migrate/workflows/team-development): This guide has been moved to the guides section. You can find the guide there. - [Troubleshooting](orm/prisma-migrate/workflows/troubleshooting): This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database. For production-focused troubleshooting, see: - [Unsupported database features](orm/prisma-migrate/workflows/unsupported-database-features): Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features cannot be represented in the Prisma schema , including but not limited to: - [Database mapping](orm/prisma-schema/data-model/database-mapping): The Prisma schema includes mechanisms that allow you to define names of certain database objects. You can: - [Data model](orm/prisma-schema/data-model/index): In this section - [Indexes](orm/prisma-schema/data-model/indexes): Prisma ORM allows configuration of database indexes, unique constraints and primary key constraints. This is in General Availability in versions 4.0.0 and later. You can enable this with the extendedIndexes Preview feature in versions 3.5.0 and later. - [Models](orm/prisma-schema/data-model/models): The data model definition part of the Prisma schema defines your application models (also called Prisma models). Models: - [How to use Prisma ORM with multiple database schemas](orm/prisma-schema/data-model/multi-schema): Multiple database schema support is currently available with the PostgreSQL, CockroachDB, and SQL Server connectors. - [Relations](orm/prisma-schema/data-model/relations/index): A relation is a connection between two models in the Prisma schema. For example, there is a one-to-many relation between User and Post because one user can have many blog posts. - [Many-to-many relations](orm/prisma-schema/data-model/relations/many-to-many-relations): Many-to-many (m-n) relations refer to relations where zero or more records on one side of the relation can be connected to zero or more records on the other side. - [One-to-many relations](orm/prisma-schema/data-model/relations/one-to-many-relations): This page introduces one-to-many relations and explains how to use them in your Prisma schema. - [One-to-one relations](orm/prisma-schema/data-model/relations/one-to-one-relations): This page introduces one-to-one relations and explains how to use them in your Prisma schema. - [Referential actions](orm/prisma-schema/data-model/relations/referential-actions/index): Referential actions determine what happens to a record when your application deletes or updates a related record. - [Special rules for referential actions in SQL Server and MongoDB](orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions): Some databases have specific requirements that you should consider if you are using referential actions. - [Relation mode](orm/prisma-schema/data-model/relations/relation-mode): In Prisma schema, relations between records are defined with the @relation attribute. For example, in the following schema there is a one-to-many relation between the User and Post models: - [Self-relations](orm/prisma-schema/data-model/relations/self-relations): A relation field can also reference its own model, in this case the relation is called a self-relation. Self-relations can be of any cardinality, 1-1, 1-n and m-n. - [Troubleshooting relations](orm/prisma-schema/data-model/relations/troubleshooting-relations): Modelling your schema can sometimes offer up some unexpected results. This section aims to cover the most prominent of those. - [Table inheritance](orm/prisma-schema/data-model/table-inheritance): Overview - [Unsupported database features](orm/prisma-schema/data-model/unsupported-database-features): Not all database functions and features of Prisma ORM's supported databases have a Prisma Schema Language equivalent. Refer to the database features matrix for a complete list of supported features. - [Views](orm/prisma-schema/data-model/views): Support for views is currently a very early Preview feature. You can add a view to your Prisma schema with the view keyword or introspect the views in your database schema with db pull. You cannot yet apply views in your schema to your database with Prisma Migrate and db push unless the changes are added manually to your migration file using the --create-only flag. For updates on progress with this feature, follow our GitHub issue. - [Prisma schema](orm/prisma-schema/index): In this section - [Introspection](orm/prisma-schema/introspection): You can introspect your database using the Prisma CLI in order to generate the data model in your Prisma schema. The data model is needed to generate Prisma Client. - [Data sources](orm/prisma-schema/overview/data-sources): A data source determines how Prisma ORM connects your database, and is represented by the datasource block in the Prisma schema. The following data source uses the postgresql provider and includes a connection URL: - [Generators](orm/prisma-schema/overview/generators): A Prisma schema can have one or more generators, represented by the generator block: - [Overview](orm/prisma-schema/overview/index): The Prisma Schema (or schema for short) is the main method of configuration for your Prisma ORM setup. It consists of the following parts: - [Schema location](orm/prisma-schema/overview/location): The default name for the Prisma Schema is a single file schema.prisma in your prisma folder. When your schema is named like this, the Prisma CLI will detect it automatically. - [PostgreSQL extensions](orm/prisma-schema/postgresql-extensions): This page introduces PostgreSQL extensions and describes how to represent extensions in your Prisma schema, how to introspect existing extensions in your database, and how to apply changes to your extensions to your database with Prisma Migrate. - [Connection URLs](orm/reference/connection-urls): Prisma ORM needs a connection URL to be able to connect to your database, e.g. when sending queries with Prisma Client or when changing the database schema with Prisma Migrate. - [Database features matrix](orm/reference/database-features): 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. - [Environment variables reference](orm/reference/environment-variables-reference): This document describes different environment variables and their use cases. - [Error message reference](orm/reference/error-reference): For more information about how to work with exceptions and error codes, see Handling exceptions and errors. - [Reference](orm/reference/index): The reference section of the documentation is a collection of reference pages that describe the Prisma ORM APIs and database implementations. - [Prisma CLI Preview features](orm/reference/preview-features/cli-preview-features): When we release a new Prisma CLI feature, it often starts in Preview so that you can test it and submit your feedback. After we improve the feature with your feedback and are satisfied with the internal test results, we promote the feature to general availability. - [Prisma Client & Prisma schema](orm/reference/preview-features/client-preview-features): When we release a new Prisma Client or Prisma schema feature, it often starts in Preview so that you can test it and submit your feedback. After we improve the feature with your feedback and are satisfied with the internal test results, we promote the feature to general availability. - [Preview features](orm/reference/preview-features/index): Some Prisma ORM features are released as Previews. Share your feedback on all Preview features on GitHub. For information about available preview features and how to enable them, see: - [Prisma CLI reference](orm/reference/prisma-cli-reference): This document describes the Prisma CLI commands, arguments, and options. - [Prisma Client API reference](orm/reference/prisma-client-reference): The Prisma Client API reference documentation is based on the following schema: - [Prisma Config reference](orm/reference/prisma-config-reference): Overview - [Prisma schema reference](orm/reference/prisma-schema-reference): datasource - [Supported databases](orm/reference/supported-databases): Prisma ORM currently supports the following databases. - [System requirements](orm/reference/system-requirements): This page provides an overview of the system requirements for Prisma ORM. - [Tools](orm/tools/index): In this section - [Prisma CLI](orm/tools/prisma-cli): The Prisma command line interface (CLI) is the primary way to interact with your Prisma project from the command line. It can initialize new project assets, generate Prisma Client, and analyze existing database structures through introspection to automatically create your application models. - [Prisma Studio](orm/tools/prisma-studio): Prisma Studio is a visual editor for the data in your database. Note that Prisma Studio is not open source but you can still create issues in the prisma/studio repo. - [General](platform/about): Overview - [Platform](platform/index): Learn about the main concepts and workflows of the Prisma Data Platform. - [Maturity levels](platform/maturity-levels): Prisma releases updates to Prisma Data Platform multiple times per week, as opposed to the Prisma ORM that we release on a set schedule every few weeks. This is why we consider the lifecycle and process for maturing features in Prisma Data Platform differently. - [About the Platform CLI](platform/platform-cli/about): This guide demonstrates how to access the Prisma Data Platform using the Prisma CLI. Get started by ensuring you have the Prisma CLI installed, following our setup instructions. - [Commands](platform/platform-cli/commands): This document describes the Prisma Data Platform's integrated Prisma CLI commands, arguments, and options. - [Platform CLI](platform/platform-cli/index): In this section - [Support](platform/support): Your feedback is invaluable, and we encourage you to share your experiences with us on Discord. - [API reference](postgres/database/api-reference): The Prisma Postgres API reference documentation is based on the following schema: - [Backups](postgres/database/backups): Prisma Postgres takes full snapshots of your database every 24 hours to back up your data. - [Caching](postgres/database/caching): Prisma Postgres supports built-in query caching to reduce database load and improve query performance. You can configure cache behavior using the cacheStrategy option available in all read queries. - [Connection pooling](postgres/database/connection-pooling): Prisma Postgres provides built-in connection pooling by default, enabled by Prisma Accelerate. By using Prisma Postgres, you get the benefits of connection pooling without having to configure anything. The efficient management of database connections allows the database to process more queries without exhausting the available database connections, making your application more scalable. - [Error reference](postgres/database/error-reference): When working with Prisma Postgres, you may encounter errors often highlighted by specific error codes during development and operations. - [Database](postgres/database/index): Learn how Prisma Postgres implements foundational database features such as built-in caching, connection pooling, backups, and secure access. These features are powered by Prisma Postgres infrastructure and designed to optimize application performance and reliability. - [TCP tunnel](postgres/database/tcp-tunnel): Prisma Postgres can be accessed securely via a TCP tunnel using the @prisma/ppg-tunnel package, an authentication proxy designed for local database workflows. This package establishes a secure connection to Prisma Postgres through a local TCP server, enabling secure access while automatically handling traffic routing and authentication. - [Tooling](postgres/database/tooling): You can view and edit your data in Prisma Postgres using either Prisma Studio or 3rd party database editors. - [Prisma Postgres®](postgres/index): In this section - [Firebase Studio](postgres/integrations/idx): If you want to explore Prisma Postgres without leaving your browser, you can try it out the via Google's Firebase Studio, a fully-fledged online IDE: - [Integrations](postgres/integrations/index): Learn how Prisma Postgres works with popular 3rd-party platforms such as Vercel, Netlify, and Firebase Studio. - [MCP Server](postgres/integrations/mcp-server): The Model-Context-Protocol (MCP) gives LLMs a way to call APIs and thus access external systems in a well-defined manner. Prisma's MCP server gives LLMs the ability to manage Prisma Postgres databases (e.g. spin up new database instances or run schema migrations). - [Netlify](postgres/integrations/netlify): The Netlify extension for Prisma Postgres connects your Netlify sites with Prisma Postgres instances. Once connected, the extension will automatically set the DATABASE_URL environment variable on your deployed Netlify sites. - [Vercel](postgres/integrations/vercel): The Vercel Marketplace integration for Prisma Postgres connects your Vercel projects with Prisma Postgres instances. Once connected, the integration will automatically set the DATABASE_URL environment variable on your deployed Vercel app. - [Getting started](postgres/introduction/getting-started): The easiest ways to get started with Prisma Postgres is by following these guides: - [Introduction](postgres/introduction/index): Get familiar with Prisma Postgres and its core concepts. This section covers what Prisma Postgres is and how to begin using it with minimal setup. - [Overview](postgres/introduction/overview): Prisma Postgres is a managed PostgreSQL database service that easily lets you create a new database, interact with it through Prisma ORM, and build applications that start small and cheap but can scale to millions of users. - [FAQ](postgres/more/faq): Common questions about how Prisma Postgres works, how queries are billed, and how it integrates with the Prisma ORM. - [More](postgres/more/index): Explore additional topics related to Prisma Postgres, including known limitations, troubleshooting guides, and frequently asked questions. - [Known limitations](postgres/more/known-limitations): Here's a list of known limitations that Prisma Postgres currently has. - [Troubleshooting](postgres/more/troubleshooting): This guide helps resolve common issues when working with Prisma Postgres. - [Query optimization](postgres/query-optimization/index): Understand how Prisma Postgres helps you optimize query performance using the Prisma Optimize toolkit. This section covers setup, recommendations, recording queries, performance metrics, and using Prisma AI for guided improvements. - [Performance metrics](postgres/query-optimization/performance-metrics): An Optimize recording session provides detailed insights into the latencies of executed queries, capturing key metrics such as average duration, 50th percentile, 99th percentile, and maximal query execution time. - [Prisma AI](postgres/query-optimization/prisma-ai): Prisma AI enables you to ask follow-up questions on a provided recommendation for additional clarity. - [Using @db.Char(n)](postgres/query-optimization/recommendations/avoid-char): Optimize provides recommendations to help you identify and resolve performance issues caused by the use of @db.Char(n) type in PostgreSQL. - [Using @db.Money](postgres/query-optimization/recommendations/avoid-db-money): Optimize provides recommendations to help you identify and resolve performance issues caused by the use of @db.Money type. - [Using timestamp(0) or timestamptz(0)](postgres/query-optimization/recommendations/avoid-timestamp-timestampz-0): Optimize provides recommendations to help you identify and resolve performance issues caused by the use of @db.Timestamp(0) and @db.Timestamptz(0) native types in PostgreSQL. - [Using @db.VarChar(n)](postgres/query-optimization/recommendations/avoid-varchar): Optimize provides recommendations to help you identify and resolve performance issues caused by the use of @db.VarChar(n) type in PostgreSQL. - [Using CURRENT_TIME](postgres/query-optimization/recommendations/current-time): The following raw SQL query uses the CURRENT_TIME function: - [Excessive number of rows returned](postgres/query-optimization/recommendations/excessive-number-of-rows-returned): Optimize provides recommendations to help you identify and resolve performance issues caused by excessive number of rows returned from a query. - [Full table scans caused by LIKE operations](postgres/query-optimization/recommendations/full-table-scans-caused-by-like-operations): Optimize provides recommendations to help you identify and resolve performance issues caused by full table scans from LIKE operations. - [Recommendations](postgres/query-optimization/recommendations/index): Optimize provides recommendations focused on performance improvements such as indexing issues, excessive data retrieval, and inefficient query patterns. Recommendations include: - [Indexing on unique columns](postgres/query-optimization/recommendations/indexing-on-unique-columns): Optimize identifies redundant indexing on unique columns and provides recommendations for better database performance. - [Long-running transactions](postgres/query-optimization/recommendations/long-running-transactions): Optimize provides actionable recommendations to help you identify and resolve performance issues caused by long-running transactions. - [Queries on unindexed columns](postgres/query-optimization/recommendations/queries-on-unindexed-columns): Optimize provides recommendations to help you identify and resolve performance issues caused by missing database indexes. - [Repeated query](postgres/query-optimization/recommendations/repeated-query): Optimize provides recommendations to help you identify and resolve performance issues caused by repeated queries. - [Overfetching](postgres/query-optimization/recommendations/select-returning): Optimize provides recommendations to help you identify and resolve performance issues caused by over-fetched data. - [Storing large objects or BLOBs in the database](postgres/query-optimization/recommendations/storing-blob-in-database): Optimize provides recommendations to help identify and resolve performance issues caused by storing large objects in the database. It also suggests alternative approaches to mitigate these challenges. - [Unnecessary indexes](postgres/query-optimization/recommendations/unnecessary-indexes): Optimize detects unnecessary indexes and recommends removing them to improve database performance. - [Recordings](postgres/query-optimization/recordings): The recordings feature helps developers debug and isolate sets of queries into distinct sessions, known as recordings. This targeted approach enables precise performance analysis and optimization by preventing the mixing of queries from different applications or test rounds, leading to clearer insights and more effective debugging. - [Setup](postgres/query-optimization/setup): Prerequisites