137 lines
3.3 KiB
Plaintext
137 lines
3.3 KiB
Plaintext
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = "postgresql://zemenu_db_user:Bx5QvACdW9iMC7k6guIQHZUM60c0a6jZ@dpg-d4n9ekggjchc73buc9qg-a.oregon-postgres.render.com/zemenu_db"
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified Boolean @default(false)
|
|
image String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
// Relations
|
|
restaurants Restaurant[]
|
|
accounts Account[]
|
|
sessions Session[]
|
|
|
|
role String? @default("user")
|
|
banned Boolean? @default(false)
|
|
banReason String?
|
|
banExpires DateTime?
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
providerId String
|
|
provider String?
|
|
accountId String
|
|
password String?
|
|
accessToken String?
|
|
refreshToken String?
|
|
expiresAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
|
|
@@map("account")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
expiresAt DateTime
|
|
token String? @unique
|
|
ipAddress String?
|
|
userAgent String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
impersonatedBy String?
|
|
|
|
@@map("session")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id @default(cuid())
|
|
identifier String
|
|
token String?
|
|
expiresAt DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
value String
|
|
|
|
@@map("verification")
|
|
}
|
|
|
|
model Restaurant {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique // used as /domain.com/slug
|
|
description String?
|
|
logo String? // image URL
|
|
ownerId String
|
|
owner User @relation(fields: [ownerId], references: [id])
|
|
|
|
template String?
|
|
|
|
categories Category[]
|
|
items MenuItem[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(uuid())
|
|
name String
|
|
image String?
|
|
|
|
restaurantId String
|
|
restaurant Restaurant @relation(fields: [restaurantId], references: [id], onDelete: Cascade)
|
|
|
|
items MenuItem[]
|
|
}
|
|
|
|
model MenuItem {
|
|
id String @id @default(uuid())
|
|
name String
|
|
description String?
|
|
price Float
|
|
image String?
|
|
|
|
categoryId String?
|
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
|
|
|
restaurantId String
|
|
restaurant Restaurant @relation(fields: [restaurantId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model File {
|
|
id String @id @default(uuid())
|
|
originalName String
|
|
storagePath String
|
|
folder String
|
|
version Int @default(1)
|
|
mimeType String
|
|
size Int
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([folder, originalName])
|
|
}
|