mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
add type
This commit is contained in:
parent
b29cece7ef
commit
5f7b6e8ccf
@ -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.'));
|
||||
|
Loading…
Reference in New Issue
Block a user