1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-20 21:01:18 -04:00

switch db from fauna to prisma & planetscale (#971)

This commit is contained in:
2022-06-23 17:26:13 -04:00
committed by GitHub
parent e782f1a8e8
commit d7eba0b39c
11 changed files with 103 additions and 247 deletions

21
lib/helpers/prisma.ts Normal file
View File

@@ -0,0 +1,21 @@
import { PrismaClient } from "@prisma/client";
// PrismaClient is attached to the `global` object in development to prevent
// exhausting your database connection limit.
//
// Learn more:
// https://pris.ly/d/help/next-js-best-practices
declare global {
// allow global `var` declarations
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}
export const prisma =
global.prisma ||
new PrismaClient({
log: ["query"],
});
if (process.env.NODE_ENV !== "production") global.prisma = prisma;