blob: b1ffd1191390ab3115db34c31930572bf3dee565 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "./schema";
import { webEnv } from "@/lib/env/web";
let _db: ReturnType<typeof drizzle> | null = null;
function getDb() {
if (!_db) {
const client = postgres(webEnv.DATABASE_URL);
_db = drizzle(client, { schema });
}
return _db;
}
export const db = getDb();
export * from "./schema";
|