feat: add vercel build script

This commit is contained in:
David Nguyen
2023-09-14 15:00:14 +10:00
committed by Mythie
parent 9dcab76cd5
commit 1be0b9e01f
25 changed files with 391 additions and 51 deletions

View File

@ -1,5 +1,7 @@
import { PrismaClient } from '@prisma/client';
import { getDatabaseUrl } from './helper';
declare global {
// We need `var` to declare a global variable in TypeScript
// eslint-disable-next-line no-var
@ -7,9 +9,13 @@ declare global {
}
if (!globalThis.prisma) {
globalThis.prisma = new PrismaClient();
globalThis.prisma = new PrismaClient({ datasourceUrl: getDatabaseUrl() });
}
export const prisma = globalThis.prisma || new PrismaClient();
export const prisma =
globalThis.prisma ||
new PrismaClient({
datasourceUrl: getDatabaseUrl(),
});
export const getPrismaClient = () => prisma;