File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ POSTGRES_USER=
1616POSTGRES_HOST =
1717POSTGRES_PASSWORD =
1818POSTGRES_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
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ yarn prettier:fix # Prettier auto-format
1818```
1919
2020After changing ` prisma/schema.prisma ` :
21+
2122``` bash
2223npx prisma generate # Regenerate Prisma client (also runs on postinstall)
2324npx prisma db push # Push schema changes to database
@@ -44,6 +45,7 @@ No test suite is configured.
4445### Database (Prisma + PostgreSQL)
4546
4647Three 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
6870Copy ` .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
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ generator client {
77
88datasource 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
You can’t perform that action at this time.
0 commit comments