diff options
| author | Maze <167211895+mazeincoding@users.noreply.github.com> | 2026-01-31 00:20:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-31 00:20:04 +0100 |
| commit | 7bf0984698e43b9aa2dd879f65951318ed410390 (patch) | |
| tree | ccf2cd590a47d550152afc07129cb55c71a9ec35 /packages/db/src/index.ts | |
| parent | 0173db99448d1c4c6415dcf15272e17551b48b04 (diff) | |
| download | opencut-7bf0984698e43b9aa2dd879f65951318ed410390.tar.gz | |
codebase overhaul (#697)
Diffstat (limited to 'packages/db/src/index.ts')
| -rw-r--r-- | packages/db/src/index.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts deleted file mode 100644 index 9b395ab6..00000000 --- a/packages/db/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { drizzle } from "drizzle-orm/postgres-js"; -import postgres from "postgres"; -import * as schema from "./schema"; -import { keys } from "./keys"; - -const { DATABASE_URL } = keys(); -// Create a lazy database instance that only initializes when accessed -let _db: ReturnType<typeof drizzle> | null = null; - -function getDb() { - if (!_db) { - const client = postgres(DATABASE_URL); - _db = drizzle(client, { schema }); - } - - return _db; -} - -// Export a proxy that forwards all calls to the actual db instance -export const db = getDb(); - -// Re-export schema for convenience -export * from "./schema"; - -// Re-export drizzle-orm functions to ensure version consistency -export { - eq, - and, - or, - not, - isNull, - isNotNull, - inArray, - notInArray, - exists, - notExists, - sql, -} from "drizzle-orm"; |
