Created
June 19, 2023 06:13
-
-
Save Spikeysanju/972fd598fa704716754a2b6250f44f99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
generator client { | |
provider = "prisma-client-js" | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
} | |
model User { | |
id String @id @unique @default(cuid()) | |
name String? | |
email String @unique | |
emailVerified DateTime? @map("email_verified") | |
image String? | |
createdAt DateTime @default(now()) @map("created_at") | |
updatedAt DateTime @updatedAt @map("updated_at") | |
accounts Account[] | |
sessions Session[] | |
products Product[] | |
cart Cart[] | |
orders Order[] | |
role Role @default(USER) | |
@@map("users") | |
} | |
model Account { | |
id String @id @default(cuid()) | |
userId String | |
type String | |
provider String | |
providerAccountId String @map("provider_account_id") | |
refresh_token String? | |
access_token String? | |
token_type String? | |
scope String? | |
id_token String? | |
session_state String? | |
oauth_token_secret String? | |
oauth_token String? | |
expires_at Int? | |
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | |
@@unique([provider, providerAccountId]) | |
@@map("accounts") | |
} | |
model Session { | |
id String @id @default(cuid()) | |
sessionToken String @unique @map("session_token") | |
expires DateTime | |
userId String @map("user_id") | |
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | |
@@map("sessions") | |
} | |
model VerificationToken { | |
identifier String | |
token String @unique | |
expires DateTime | |
@@unique([identifier, token]) | |
@@map("verification_tokens") | |
} | |
model Product { | |
id String @id @default(cuid()) | |
name String | |
description String? | |
price Int | |
image String | |
userId String @map("user_id") | |
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | |
createdAt DateTime @default(now()) @map("created_at") | |
updatedAt DateTime @updatedAt @map("updated_at") | |
@@map("products") | |
} | |
model Cart { | |
id String @id @default(cuid()) | |
userId String @map("user_id") | |
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | |
productId String @map("product_id") | |
quantity Int? | |
createdAt DateTime @default(now()) @map("created_at") | |
updatedAt DateTime @updatedAt @map("updated_at") | |
@@map("carts") | |
} | |
model Order { | |
id String @id @default(cuid()) | |
userId String @map("user_id") | |
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | |
productId String @map("product_id") | |
quantity Int? | |
totalPrice Int? | |
createdAt DateTime @default(now()) @map("created_at") | |
updatedAt DateTime @updatedAt @map("updated_at") | |
orderStatus OrderStatus @default(PROCESSING) @map("order_status") | |
@@map("orders") | |
} | |
enum OrderStatus { | |
PROCESSING | |
COMPLETED | |
CANCELLED | |
} | |
enum Role { | |
USER | |
ADMIN | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment