Skip to content

Commit

Permalink
✨ prisma schema initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
nawinsharma committed Jun 24, 2024
1 parent 9ee9e62 commit ef0ac5d
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 12 deletions.
213 changes: 203 additions & 10 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@
},
"devDependencies": {
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20",
"@types/node": "^20.14.8",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"eslint-config-prettier": "^9.1.0",
"postcss": "^8",
"prisma": "^5.15.1",
"tailwindcss": "^3.3.0",
"typescript": "^5"
"ts-node": "^10.9.2",
"typescript": "^5.5.2"
}
}
39 changes: 39 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Category {
id Int @id @default(autoincrement())
name String
products Product[]
}

model HeroImage {
id Int @id @default(autoincrement())
image1 String
image2 String
}

model Product {
id Int @id @default(autoincrement())
name String
description String
slug String @unique
price Float
priceId String @map("price_id")
categoryId Int
category Category @relation(fields: [categoryId], references: [id])
images Image[]
}

model Image {
id Int @id @default(autoincrement())
url String
productId Int
product Product @relation(fields: [productId], references: [id])
}

0 comments on commit ef0ac5d

Please sign in to comment.