// db/db.ts // PostgreSQL connection import * as schema from "./schema.ts"; import { drizzle } from "drizzle-orm/node-postgres"; import { Pool } from "pg"; const pool = new Pool({ connectionString: Deno.env.get("POSTGRES_OPTIONS")!, }); export const db = drizzle({ client: pool, schema }); /** Check if database connection is available */ export async function checkDatabaseConnection(): Promise { try { const client = await pool.connect(); await client.query("SELECT 1"); client.release(); return true; } catch (error) { console.error("Database connection check failed:", error); return false; } }