Skip to content

Commit

Permalink
refactor: update Prisma dependencies and integrate extension-accelerate
Browse files Browse the repository at this point in the history
  • Loading branch information
A91y committed Nov 6, 2024
1 parent a82362e commit 5188040
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 39 deletions.
79 changes: 47 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"build": "next build && next-sitemap",
"start": "next start",
"lint": "next lint",
"postinstall": "prisma generate"
"postinstall": "prisma generate --no-engine"
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@prisma/client": "^5.16.1",
"@prisma/client": "^5.22.0",
"@prisma/extension-accelerate": "^1.2.1",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
Expand Down Expand Up @@ -75,7 +76,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.4",
"postcss": "^8",
"prisma": "^5.16.1",
"prisma": "^5.22.0",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
Expand Down
7 changes: 3 additions & 4 deletions src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { PrismaClient } from "@prisma/client";
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from '@prisma/extension-accelerate'

declare global {
var prisma: PrismaClient | undefined;
}

export const db = globalThis.prisma || new PrismaClient();

if (process.env.NODE_ENV !== "production") globalThis.prisma = db;
export const db = new PrismaClient().$extends(withAccelerate())

0 comments on commit 5188040

Please sign in to comment.