mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Allow custom release URL.
This commit is contained in:
parent
64f1841ae4
commit
e4c4019e25
7 changed files with 27 additions and 21 deletions
20
lib/db.js
20
lib/db.js
|
|
@ -2,7 +2,7 @@ import { PrismaClient } from '@prisma/client';
|
|||
import chalk from 'chalk';
|
||||
|
||||
BigInt.prototype.toJSON = function () {
|
||||
return this.toString();
|
||||
return Number(this);
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -18,20 +18,20 @@ function logQuery(e) {
|
|||
console.log(chalk.yellow(e.params), '->', e.query, chalk.greenBright(`${e.duration}ms`));
|
||||
}
|
||||
|
||||
let prisma;
|
||||
function getClient(options) {
|
||||
const prisma = new PrismaClient(options);
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
prisma = new PrismaClient(options);
|
||||
} else {
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient(options);
|
||||
if (process.env.LOG_QUERY) {
|
||||
prisma.$on('query', logQuery);
|
||||
}
|
||||
|
||||
prisma = global.prisma;
|
||||
return prisma;
|
||||
}
|
||||
|
||||
if (process.env.LOG_QUERY) {
|
||||
prisma.$on('query', logQuery);
|
||||
const prisma = global.prisma || getClient(options);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
global.prisma = prisma;
|
||||
}
|
||||
|
||||
export default prisma;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue