You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We know databaseUrl is defined here due to getConnectionType logic
109
+
neonConfig.fetchConnectionCache=true;
110
+
db=drizzleNeon(neon(databaseUrl!),{ schema });
111
+
break;
112
+
113
+
caseConnectionType.VERCEL_EXTERNAL_POOL:
114
+
logger.warn(
115
+
"Using standard pg.Pool with external DATABASE_URL on Vercel. Ensure the URL points to a pooler."
116
+
);
117
+
logger.warn(
118
+
"[CRITICAL] Ensure the pooler mode is set to 'transaction' or that you have a very beefy database server otherwise IT WILL use all your database connections."
119
+
);
120
+
// We know databaseUrl is defined here due to getConnectionType logic
121
+
db=drizzlePg(
122
+
newpg.Pool({
123
+
connectionString: databaseUrl!,
124
+
max: 1,// Recommended for Vercel serverless functions connecting to external DBs
125
+
}),
126
+
{ schema }
127
+
);
128
+
break;
129
+
130
+
caseConnectionType.STANDARD_POOL:
131
+
logger.log(
132
+
"Using standard PostgreSQL driver (pg.Pool) with DATABASE_URL (Not on Vercel/Neon)"
133
+
);
134
+
// We know databaseUrl is defined here due to getConnectionType logic
135
+
logger.log(`Using pg.Pool with pool size: ${poolSize}`);
136
+
db=drizzlePg(
137
+
newpg.Pool({
138
+
connectionString: databaseUrl!,
139
+
max: poolSize,
140
+
}),
141
+
{ schema }
142
+
);
143
+
break;
144
+
145
+
caseConnectionType.INVALID:
146
+
default:
147
+
// This case should theoretically not be reached due to the initial validation
148
+
// and the logic in getConnectionType, but it's good practice to handle it.
149
+
logger.error("Could not determine database connection method.");
0 commit comments