A data source determines how Prisma 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 string:

datasource db {
provider = "postgresql"
url = "postgresql://johndoe:mypassword@localhost:5432/mydb?schema=public"

A Prisma schema can only have one data source. However, you can:

Multiple providers

Important: Multiple providers was deprecated in 2.11.0 and will be removed in a future release.

The provider field accepts an array of providers:

datasource db {
provider = ["postgresql", "mysql"]
url = env("DATABASE_URL")

Prisma uses the provider that is compatible with the the value of the url field. Use cases for multiple providers include:

  • You have multiple environments (development, QA, production) and each environment uses a different provider

SSL certificates

Prisma resolves SSL certificates relative to the .\prisma directory. If your certificate files are located in the root directory, use relative paths for certificates:

1datasource db {
2 provider = "postgresql"
3 url = "postgresql://johndoe:mypassword@localhost:5432/mydb?schema=public&sslmode=require&sslcert=../server-ca.pem&sslidentity=../client-identity.p12&sslpassword=<REDACTED>"
Edit this page on GitHub