-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
97 lines (86 loc) · 3.51 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// This file is automatically generated by Keystone, do not modify it manually.
// Modify your Keystone config when you want to change this.
datasource postgresql {
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
model User {
id String @id @default(cuid())
name String @default("")
nickname String @default("")
isAdmin Boolean @default(false)
phone String @default("")
email String @unique @default("")
password String
role UserRoleType? @default(Customer)
restaurants Restaurant[] @relation("Restaurant_owner")
reservations Reservation[] @relation("Reservation_user")
bookmarks Restaurant[] @relation("User_bookmarks")
reviews Review[] @relation("Review_user")
}
model Restaurant {
id String @id @default(cuid())
name String @default("")
description String @default("")
locationRaw String @default("")
category String @default("")
owner User? @relation("Restaurant_owner", fields: [ownerId], references: [id])
ownerId String? @map("owner")
reservationPrice Float
info String @default("")
images Image[] @relation("Restaurant_images")
reviews Review[] @relation("Review_restaurant")
from_User_bookmarks User[] @relation("User_bookmarks")
from_Reservation_restaurant Reservation[] @relation("Reservation_restaurant")
@@index([ownerId])
}
model Image {
id String @id @default(cuid())
name String @default("")
description String @default("")
image_filesize Int?
image_extension String?
image_width Int?
image_height Int?
image_id String?
from_Restaurant_images Restaurant[] @relation("Restaurant_images")
from_Review_images Review[] @relation("Review_images")
}
model Reservation {
id String @id @default(cuid())
time DateTime
reservationFee Int
refund Int?
user User? @relation("Reservation_user", fields: [userId], references: [id])
userId String? @map("user")
restaurant Restaurant? @relation("Reservation_restaurant", fields: [restaurantId], references: [id])
restaurantId String? @map("restaurant")
@@index([userId])
@@index([restaurantId])
}
model Review {
id String @id @default(cuid())
user User? @relation("Review_user", fields: [userId], references: [id])
userId String? @map("user")
images Image[] @relation("Review_images")
timestamp DateTime? @default(now()) @updatedAt
edited Boolean @default(false)
title String @default("")
content String @default("")
likes Int? @default(0)
restaurant Restaurant? @relation("Review_restaurant", fields: [restaurantId], references: [id])
restaurantId String? @map("restaurant")
rating Float
@@index([userId])
@@index([restaurantId])
}
enum UserRoleType {
Customer
Owner
}