fix mysql retention query

This commit is contained in:
Francis Cao 2023-08-15 12:15:27 -07:00
parent a16b0cef3a
commit 495b7f1f20
2 changed files with 21 additions and 6 deletions

View file

@ -43,7 +43,19 @@ function getDayDiffQuery(field1: string, field2: string): string {
}
if (db === MYSQL) {
return `DATEDIFF(${field1}, ${field2});`;
return `DATEDIFF(${field1}, ${field2})`;
}
}
function getCastColumnQuery(field: string, type: string): string {
const db = getDatabaseType(process.env.DATABASE_URL);
if (db === POSTGRESQL) {
return `${field}::${type}`;
}
if (db === MYSQL) {
return `${field}`;
}
}
@ -206,6 +218,7 @@ export default {
...prisma,
getAddMinutesQuery,
getDayDiffQuery,
getCastColumnQuery,
getDateQuery,
getTimestampIntervalQuery,
getFilterQuery,