Skip to content

Commit 612f9f9

Browse files
committed
chore: update PrismaClient configuration to include logging options based on environment and add binary targets for improved compatibility
1 parent ffdc9f7 commit 612f9f9

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

.vercelignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.next
3+
.env*.local
4+
*.log
5+
.DS_Store

lib/db.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const globalForPrisma = globalThis as unknown as {
44
prisma: PrismaClient | undefined;
55
};
66

7-
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
7+
export const prisma = globalForPrisma.prisma ?? new PrismaClient({
8+
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
9+
});
810

9-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
11+
if (process.env.NODE_ENV !== 'production') {
12+
globalForPrisma.prisma = prisma;
13+
}

prisma/schema.prisma

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// learn more about it in the docs: https://pris.ly/d/prisma-schema
33

44
generator client {
5-
provider = "prisma-client-js"
5+
provider = "prisma-client-js"
6+
binaryTargets = ["native", "debian-openssl-3.0.x"]
67
}
78

89
datasource db {

vercel.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"buildCommand": "prisma generate && pnpm build",
3+
"installCommand": "pnpm install --frozen-lockfile",
4+
"framework": "nextjs",
5+
"env": {
6+
"PRISMA_GENERATE_SKIP_AUTOINSTALL": "true"
7+
}
8+
}

0 commit comments

Comments
 (0)