refactor: rename db variable to dbConnection for improved clarity and export the connection for consistent usage across the application

This commit is contained in:
Mauricio Siu
2026-02-24 22:44:48 -06:00
parent 66ef8a0a5f
commit c22e006e30

View File

@@ -13,9 +13,9 @@ declare global {
var db: Database | undefined;
}
export let db: Database;
let dbConnection: Database;
if (process.env.NODE_ENV === "production") {
db = drizzle(postgres(dbUrl), {
dbConnection = drizzle(postgres(dbUrl), {
schema,
});
} else {
@@ -24,7 +24,9 @@ if (process.env.NODE_ENV === "production") {
schema,
});
db = global.db;
dbConnection = global.db;
}
export const db: Database = dbConnection;
export { dbUrl };