MCPcopy Create free account
hub / github.com/3dugc/3D-Model-Optimizer / getPostgresPool

Function getPostgresPool

src/database/postgres.ts:14–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12let migrationPromise: Promise<void> | undefined;
13
14export function getPostgresPool(): PgPool {
15 if (!config.database.url) {
16 throw new Error('Postgres state store requires DATABASE_URL.');
17 }
18 if (!pool) {
19 pool = new Pool({
20 connectionString: config.database.url,
21 ssl: config.database.ssl
22 ? {
23 rejectUnauthorized: config.database.sslRejectUnauthorized,
24 }
25 : undefined,
26 });
27 }
28 return pool;
29}
30
31export async function ensurePostgresSchema(client: SqlQueryable = getPostgresPool()): Promise<void> {
32 if (client === pool && migrationPromise) return migrationPromise;

Callers 10

constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
readPostgresSnapshotFunction · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
ensurePostgresSchemaFunction · 0.85
withPostgresTransactionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected