File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 " Bash(pnpm install)" ,
55 " Bash(npm install:*)" ,
66 " Bash(git add:*)" ,
7- " Bash(git commit:*)"
7+ " Bash(git commit:*)" ,
8+ " Bash(pnpm run build:*)" ,
9+ " Bash(npm run build:*)" ,
10+ " Bash(export PATH=\" $HOME/.local/share/pnpm:$PATH\" )"
811 ]
912 }
1013}
Original file line number Diff line number Diff line change 11import { DATABASE_URL , DATABASE_AUTH_TOKEN } from '@/config' ;
22import { drizzle } from 'drizzle-orm/libsql' ;
3- import * as schema from "./schema" ;
3+ import type { LibSQLDatabase } from 'drizzle-orm/libsql' ;
4+ import * as schema from "./schema" ;
45
5- export const db = drizzle ( {
6- connection : {
7- url : DATABASE_URL ,
8- authToken : DATABASE_AUTH_TOKEN ,
9- } ,
10- schema
6+ // Lazy initialization to avoid connection during build time
7+ let _db : LibSQLDatabase < typeof schema > | null = null ;
8+
9+ export const db = new Proxy ( { } as LibSQLDatabase < typeof schema > , {
10+ get ( _target , prop ) {
11+ if ( ! _db ) {
12+ _db = drizzle ( {
13+ connection : {
14+ url : DATABASE_URL ,
15+ authToken : DATABASE_AUTH_TOKEN ,
16+ } ,
17+ schema
18+ } ) ;
19+ }
20+ return Reflect . get ( _db , prop ) ;
21+ }
1122} ) ;
You can’t perform that action at this time.
0 commit comments