-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29de1f8
commit ed4af22
Showing
4 changed files
with
24 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import 'server-only'; | ||
import { drizzle } from 'drizzle-orm/postgres-js'; | ||
import postgres from 'postgres'; | ||
|
||
import * as schema from './schema'; | ||
|
||
// const queryClient = postgres(process.env.DB_URL!); | ||
// export const db = drizzle(queryClient, { schema }); | ||
const queryClient = postgres(process.env.DB_URL!); | ||
export const db = drizzle(queryClient, { schema }); | ||
|
||
let db: ReturnType<typeof drizzle>; | ||
// let db: ReturnType<typeof drizzle>; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
const queryClient = postgres(process.env.DB_URL!); | ||
db = drizzle(queryClient, { schema }); | ||
} else { | ||
const queryClient = postgres(process.env.DB_URL!); | ||
if (!global.db) { | ||
global.db = drizzle(queryClient, { schema }); | ||
} | ||
// if (process.env.NODE_ENV === 'production') { | ||
// const queryClient = postgres(process.env.DB_URL!); | ||
// db = drizzle(queryClient, { schema }); | ||
// } else { | ||
// const queryClient = postgres(process.env.DB_URL!); | ||
// if (!global.db) { | ||
// global.db = drizzle(queryClient, { schema }); | ||
// } | ||
|
||
db = global.db; | ||
} | ||
// db = global.db; | ||
// } | ||
|
||
export { db }; | ||
// export { db }; |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.