From 96a54fc9cc99d7d020288da6ed1ea79df1bd4c9a Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 9 Jun 2026 16:51:55 -0700 Subject: [PATCH] Fix import issue in migrations --- server/db/pg/driver.ts | 2 +- server/db/pg/logsDriver.ts | 7 +++---- server/db/pg/poolConfig.ts | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/server/db/pg/driver.ts b/server/db/pg/driver.ts index 9f6901dda..9e07a6234 100644 --- a/server/db/pg/driver.ts +++ b/server/db/pg/driver.ts @@ -87,7 +87,7 @@ function createDb() { export const db = createDb(); export default db; -export const primaryDb = db.$primary as typeof db; // is this typeof a problem - techincally they are different types +export const primaryDb = db.$primary as typeof db; // is this typeof a problem - technically they are different types export type Transaction = Parameters< Parameters<(typeof db)["transaction"]>[0] >[0]; diff --git a/server/db/pg/logsDriver.ts b/server/db/pg/logsDriver.ts index 146b8fb2f..2c34136de 100644 --- a/server/db/pg/logsDriver.ts +++ b/server/db/pg/logsDriver.ts @@ -2,7 +2,7 @@ import { drizzle as DrizzlePostgres } from "drizzle-orm/node-postgres"; import { readConfigFile } from "@server/lib/readConfigFile"; import { withReplicas } from "drizzle-orm/pg-core"; import { build } from "@server/build"; -import { db as mainDb, primaryDb as mainPrimaryDb } from "./driver"; +import { db as mainDb } from "./driver"; import { createPool } from "./poolConfig"; function createLogsDb() { @@ -63,8 +63,7 @@ function createLogsDb() { }) ); } else { - const maxReplicaConnections = - poolConfig?.max_replica_connections || 20; + const maxReplicaConnections = poolConfig?.max_replica_connections || 20; for (const conn of replicaConnections) { const replicaPool = createPool( conn.connection_string, @@ -91,4 +90,4 @@ function createLogsDb() { export const logsDb = createLogsDb(); export default logsDb; -export const primaryLogsDb = logsDb.$primary; \ No newline at end of file +export const primaryLogsDb = logsDb.$primary; diff --git a/server/db/pg/poolConfig.ts b/server/db/pg/poolConfig.ts index f753121c1..b893c2159 100644 --- a/server/db/pg/poolConfig.ts +++ b/server/db/pg/poolConfig.ts @@ -1,5 +1,4 @@ import { Pool, PoolConfig } from "pg"; -import logger from "@server/logger"; export function createPoolConfig( connectionString: string, @@ -27,7 +26,7 @@ export function attachPoolErrorHandlers(pool: Pool, label: string): void { pool.on("error", (err) => { // This catches errors on idle clients in the pool. Without this // handler an unexpected disconnect would crash the process. - logger.error( + console.error( `Unexpected error on idle ${label} database client: ${err.message}` ); }); @@ -36,7 +35,7 @@ export function attachPoolErrorHandlers(pool: Pool, label: string): void { // Set a statement timeout on every new connection so a single slow // query can't block the pool forever client.query("SET statement_timeout = '30s'").catch((err: Error) => { - logger.warn( + console.warn( `Failed to set statement_timeout on ${label} client: ${err.message}` ); }); @@ -60,4 +59,4 @@ export function createPool( ); attachPoolErrorHandlers(pool, label); return pool; -} \ No newline at end of file +}