Configuring Database Providers
1. Using PostgreSQL Provider
| Option | Description |
|---|---|
provider = "postgresql" | Driver name |
schemas = ["public","auth"] | Multi-schema (preview) |
?connection_limit=10 | Pool size |
?pgbouncer=true | PgBouncer compatibility |
?sslmode=require | Enforce SSL |
2. Configuring MySQL Provider
| Option | Description |
|---|---|
provider = "mysql" | MySQL/MariaDB |
?sslaccept=strict | Validate SSL cert |
?connect_timeout=10 | Timeout (seconds) |
?socket=/tmp/mysql.sock | Unix socket connection |
3. Setting Up SQLite Database
| Feature | Notes |
|---|---|
| URL | file:./dev.db (relative to schema) |
| Supported types | No Decimal, no enums, limited JSON |
| Concurrency | Single writer; use WAL mode |
| Use case | Development, tests, embedded apps |
4. Using SQL Server Provider
| Option | Value |
|---|---|
provider | "sqlserver" |
| URL prefix | sqlserver:// |
| Encryption | encrypt=true;trustServerCertificate=true |
| Schema | schema=dbo |
5. Configuring MongoDB Provider
| Concept | Mapping |
|---|---|
| Provider | provider = "mongodb" |
| Primary key | id String @id @default(auto()) @map("_id") @db.ObjectId |
| Relations | Embedded or referenced via ObjectId arrays |
| Migrations | Not supported; use db push |
6. Setting Up CockroachDB
| Feature | Notes |
|---|---|
| Provider | "cockroachdb" |
| ID type | @default(sequence()) for unique IDs |
| URL | postgresql://USER@HOST:26257/DB?sslmode=verify-full |
7. Configuring Connection URLs
| Parameter | Purpose |
|---|---|
connection_limit | Max pool connections |
pool_timeout | Wait time (sec) for a connection |
connect_timeout | TCP connect timeout |
socket_timeout | Query socket timeout |
statement_cache_size | Prepared-statement cache |
8. Using SSL Connections
| Param | PG / MySQL |
|---|---|
sslmode | disable | prefer | require | verify-ca | verify-full |
sslcert | Client cert path |
sslkey | Client key path |
sslrootcert | CA bundle path |
9. Connecting to Cloud Databases
| Provider | Notes |
|---|---|
| Neon | Use @neondatabase/serverless driver adapter |
| Supabase | Use pooler URL + ?pgbouncer=true&connection_limit=1 |
| AWS RDS | Standard PG URL + SSL CA bundle |
| Railway / Render | Provided DATABASE_URL works directly |
10. Using PlanetScale
| Setting | Value |
|---|---|
| Provider | "mysql" |
| Referential integrity | relationMode = "prisma" (no FK constraints) |
| Driver adapter | @prisma/adapter-planetscale |
| Migrations | Use db push + PlanetScale deploy requests |
Warning: PlanetScale and Vitess do not support foreign key constraints. Set
relationMode = "prisma" so Prisma emulates referential integrity in application code.