blob: 29e3ffda388cc9969b7742f1f3a744b0652e45f3 (
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 "@/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";
|