Chore: set up cloudflare #67

Closed
BenjaminPalko wants to merge 13 commits from cloudflare into staging
Showing only changes of commit 086290e76c - Show all commits

View file

@ -2,9 +2,14 @@ import { DATABASE_URL } from '$env/static/private';
import { PrismaPg } from '@prisma/adapter-pg'; import { PrismaPg } from '@prisma/adapter-pg';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import pg from 'pg'; import pg from 'pg';
import { logger } from '../logger';
const connectionString = `${DATABASE_URL}`; const connectionString = `${DATABASE_URL}`;
const pool = new pg.Pool({ connectionString }); const pool = new pg.Pool({ connectionString });
const adapter = new PrismaPg(pool); const adapter = new PrismaPg(pool);
export const prisma = new PrismaClient({ adapter }); export const prisma = new PrismaClient({ adapter, log: [{ emit: 'event', level: 'query' }] });
prisma.$on('query', (event) => {
logger.debug(`Query [${event.duration}ms]: ${event.query}`);
});