From 5f7b6e8ccf136b2aabb969fbfd88b4e2de74bce4 Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Fri, 26 Aug 2022 22:01:40 -0700 Subject: [PATCH] add type --- lib/relational.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/relational.js b/lib/relational.js index e5b9f2ce..443420de 100644 --- a/lib/relational.js +++ b/lib/relational.js @@ -42,7 +42,7 @@ if (process.env.NODE_ENV !== 'production') { export { prisma }; export function getDateQuery(field, unit, timezone) { - const db = getDatabase(process.env.DATABASE_URL); + const db = getDatabase(process.env.DATABASE_URL, process.env.DATABASE_TYPE); if (db === POSTGRESQL) { if (timezone) { @@ -63,7 +63,7 @@ export function getDateQuery(field, unit, timezone) { } export function getTimestampInterval(field) { - const db = getDatabase(process.env.DATABASE_URL); + const db = getDatabase(process.env.DATABASE_URL, process.env.DATABASE_TYPE); if (db === POSTGRESQL) { return `floor(extract(epoch from max(${field}) - min(${field})))`; @@ -164,7 +164,7 @@ export async function runQuery(query) { } export async function rawQuery(query, params = []) { - const db = getDatabase(process.env.DATABASE_URL); + const db = getDatabase(process.env.DATABASE_URL, process.env.DATABASE_TYPE); if (db !== POSTGRESQL && db !== MYSQL) { return Promise.reject(new Error('Unknown database.'));