Skip to content

Commit a85259d

Browse files
committed
installed prisma and setup client
1 parent e5a0999 commit a85259d

File tree

5 files changed

+115
-2
lines changed

5 files changed

+115
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ yarn-error.log*
2727

2828
# local env files
2929
.env*.local
30+
.env
3031

3132
# vercel
3233
.vercel

package-lock.json

+82-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
},
1111
"dependencies": {
1212
"@heroicons/react": "^2.1.5",
13+
"@prisma/client": "^5.18.0",
1314
"@radix-ui/react-dropdown-menu": "^2.1.1",
1415
"@radix-ui/react-select": "^2.1.1",
1516
"@radix-ui/react-slot": "^1.1.0",
16-
"axios": "^1.7.3",
17+
"axios": "^1.3.1",
1718
"class-variance-authority": "^0.7.0",
1819
"clsx": "^2.1.1",
1920
"framer-motion": "^11.3.21",
2021
"lucide-react": "^0.424.0",
2122
"next": "14.2.5",
2223
"next-themes": "^0.3.0",
24+
"prisma": "^5.18.0",
2325
"react": "^18",
2426
"react-dom": "^18",
2527
"tailwind-merge": "^2.4.0",

prisma/client.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { PrismaClient } from '@prisma/client'
2+
3+
const prismaClientSingleton = () => {
4+
return new PrismaClient()
5+
}
6+
7+
declare const globalThis: {
8+
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
9+
} & typeof global;
10+
11+
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton()
12+
13+
export default prisma
14+
15+
if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma

prisma/schema.prisma

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This is your Prisma schema file,
2+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3+
4+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6+
7+
generator client {
8+
provider = "prisma-client-js"
9+
}
10+
11+
datasource db {
12+
provider = "postgresql"
13+
url = env("DATABASE_URL")
14+
}

0 commit comments

Comments
 (0)