mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-19 02:15:17 +00:00
refactor: rename db variable to dbConnection for improved clarity and export the connection for consistent usage across the application
This commit is contained in:
@@ -13,9 +13,9 @@ declare global {
|
|||||||
var db: Database | undefined;
|
var db: Database | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let db: Database;
|
let dbConnection: Database;
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
db = drizzle(postgres(dbUrl), {
|
dbConnection = drizzle(postgres(dbUrl), {
|
||||||
schema,
|
schema,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -24,7 +24,9 @@ if (process.env.NODE_ENV === "production") {
|
|||||||
schema,
|
schema,
|
||||||
});
|
});
|
||||||
|
|
||||||
db = global.db;
|
dbConnection = global.db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const db: Database = dbConnection;
|
||||||
|
|
||||||
export { dbUrl };
|
export { dbUrl };
|
||||||
|
|||||||
Reference in New Issue
Block a user