Skip to content

Commit 8c26173

Browse files
committed
fix(OUT-3675): updated documentation
1 parent 5e8b5d8 commit 8c26173

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ POSTGRES_USER=
1616
POSTGRES_HOST=
1717
POSTGRES_PASSWORD=
1818
POSTGRES_DATABASE=
19+
# Used by prisma/schema.prisma. Wraps POSTGRES_PRISMA_URL with Prisma pool params.
20+
# Keep connection_limit small (~5) for Vercel serverless — see schema.prisma for why.
21+
POSTGRES_PRISMA_URL_HIGHER_CONNECTION_LIMIT="$POSTGRES_PRISMA_URL&connection_limit=5&pool_timeout=20"
1922

2023

2124
# --- Vercel hosts and credentials

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ yarn prettier:fix # Prettier auto-format
1818
```
1919

2020
After changing `prisma/schema.prisma`:
21+
2122
```bash
2223
npx prisma generate # Regenerate Prisma client (also runs on postinstall)
2324
npx prisma db push # Push schema changes to database
@@ -44,6 +45,7 @@ No test suite is configured.
4445
### Database (Prisma + PostgreSQL)
4546

4647
Three models in `prisma/schema.prisma`:
48+
4749
- `CustomFieldAccess` — per-portal field-level VIEW/EDIT permissions
4850
- `ClientProfileUpdates` — audit log of profile changes (stores full custom fields + changed fields as JSONB)
4951
- `Setting` — per-portal JSON configuration
@@ -66,6 +68,7 @@ Settings and custom field access are stored as two copies in context: a read-onl
6668
## Environment Setup
6769

6870
Copy `.env.example` to `.env.local`. Required variables:
71+
6972
- `COPILOT_API_KEY` — from the Assembly/Copilot dashboard
7073
- `COPILOT_ENV``local` for test tokens, `production` for real tokens
7174
- `POSTGRES_PRISMA_URL` and related DB vars — PostgreSQL connection strings

prisma/schema.prisma

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ generator client {
77

88
datasource db {
99
provider = "postgresql"
10-
// Vercel won't let us change the POSTGRES_* config so update it with a connection_limit key using a custom env var like
11-
// POSTGRES_PRISMA_URL_HIGHER_CONNECTION_LIMIT="$POSTGRES_PRISMA_URL&connection_limit=20"
10+
// Vercel won't let us edit POSTGRES_* directly, so we wrap POSTGRES_PRISMA_URL with extra params via a custom env var.
11+
// For Vercel serverless, keep connection_limit small — each lambda gets its own client-side pool, and large values
12+
// multiplied by concurrent lambdas saturate pgBouncer (see https://pris.ly/d/connection-pool). Recommended value:
13+
// POSTGRES_PRISMA_URL_HIGHER_CONNECTION_LIMIT="$POSTGRES_PRISMA_URL&connection_limit=5&pool_timeout=20"
1214
url = env("POSTGRES_PRISMA_URL_HIGHER_CONNECTION_LIMIT")
1315
directUrl = env("POSTGRES_URL_NON_POOLING")
1416
// Emulates relationships in Prisma client itself. Better for serverless databases like neon or planetscale

0 commit comments

Comments
 (0)