mirror of
https://github.com/kremalicious/umami.git
synced 2025-01-26 10:11:09 +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 { prisma };
|
||||||
|
|
||||||
export function getDateQuery(field, unit, timezone) {
|
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 (db === POSTGRESQL) {
|
||||||
if (timezone) {
|
if (timezone) {
|
||||||
@ -63,7 +63,7 @@ export function getDateQuery(field, unit, timezone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getTimestampInterval(field) {
|
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) {
|
if (db === POSTGRESQL) {
|
||||||
return `floor(extract(epoch from max(${field}) - min(${field})))`;
|
return `floor(extract(epoch from max(${field}) - min(${field})))`;
|
||||||
@ -164,7 +164,7 @@ export async function runQuery(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function rawQuery(query, params = []) {
|
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) {
|
if (db !== POSTGRESQL && db !== MYSQL) {
|
||||||
return Promise.reject(new Error('Unknown database.'));
|
return Promise.reject(new Error('Unknown database.'));
|
||||||
|
Loading…
Reference in New Issue
Block a user