mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-05 02:24:51 +10:00
19 lines
543 B
TypeScript
19 lines
543 B
TypeScript
import { sql } from "drizzle-orm";
|
|
import { drizzle } from "drizzle-orm/node-postgres";
|
|
import { Pool } from "pg";
|
|
import { env } from "@/utils/env";
|
|
|
|
const pool = new Pool({ connectionString: env.DATABASE_URL });
|
|
const db = drizzle({ client: pool });
|
|
|
|
try {
|
|
const result = await db.execute(sql`SELECT 1 as connected`);
|
|
console.log("✅ Database connection successful", JSON.stringify(result));
|
|
} catch (error) {
|
|
console.error("🚨 Database connection failed:", error);
|
|
process.exit(1);
|
|
} finally {
|
|
await pool.end();
|
|
process.exit(0);
|
|
}
|