mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 04:25:39 +01:00
Add sql param logic.
This commit is contained in:
parent
cc46cfdcbf
commit
d93c2f9dd7
9 changed files with 46 additions and 32 deletions
|
|
@ -36,6 +36,18 @@ function logQuery(e) {
|
|||
log(chalk.yellow(e.params), '->', e.query, chalk.greenBright(`${e.duration}ms`));
|
||||
}
|
||||
|
||||
function toUuid() {
|
||||
const db = getDatabaseType(process.env.DATABASE_URL);
|
||||
|
||||
if (db === POSTGRESQL) {
|
||||
return '::uuid';
|
||||
}
|
||||
|
||||
if (db === MYSQL) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function getClient(options) {
|
||||
const prisma = new PrismaClient(options);
|
||||
|
||||
|
|
@ -248,6 +260,7 @@ const prisma = global[PRISMA] || getClient(PRISMA_OPTIONS);
|
|||
export default {
|
||||
client: prisma,
|
||||
log,
|
||||
toUuid,
|
||||
getDateQuery,
|
||||
getTimestampInterval,
|
||||
getFilterQuery,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue