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:
21
lib/helpers/prisma.ts
Normal file
21
lib/helpers/prisma.ts
Normal 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;
|
Reference in New Issue
Block a user