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 URL:

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:

Note: Multiple provider support was removed in 2.22.0. Please see Deprecation of provider array notation for more information.

SSL certificates

Some data source providers allow you to configure your connection with SSL, and provide parameters for the url to specificy the location of certificates.

Prisma resolves SSL certificates relative to the ./prisma directory. If your certificate files are located outside that directory, e.g. your project root directory, use relative paths for certificates:

datasource db {
provider = "postgresql"
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