mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Website components. Update chart component.
This commit is contained in:
parent
d81ee3932d
commit
bdcdcd9d13
9 changed files with 165 additions and 43 deletions
18
lib/db.js
18
lib/db.js
|
|
@ -1,13 +1,27 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
export const prisma = new PrismaClient({
|
||||
const options = {
|
||||
log: [
|
||||
{
|
||||
emit: 'event',
|
||||
level: 'query',
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
let prisma;
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
prisma = new PrismaClient(options);
|
||||
} else {
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient(options);
|
||||
}
|
||||
|
||||
prisma = global.prisma;
|
||||
}
|
||||
|
||||
export default prisma;
|
||||
|
||||
prisma.on('query', e => {
|
||||
if (process.env.LOG_QUERY) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue