mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
20 lines
420 B
TypeScript
20 lines
420 B
TypeScript
import { drizzle } from "drizzle-orm/postgres-js";
|
|
import postgres from "postgres";
|
|
import * as schema from "./schema";
|
|
import { toolsEnv } from "@opencut/env/tools";
|
|
|
|
let _db: ReturnType<typeof drizzle> | null = null;
|
|
|
|
function getDb() {
|
|
if (!_db) {
|
|
const client = postgres(toolsEnv.DATABASE_URL);
|
|
_db = drizzle(client, { schema });
|
|
}
|
|
|
|
return _db;
|
|
}
|
|
|
|
export const db = getDb();
|
|
|
|
export * from "./schema";
|