-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.prisma
More file actions
106 lines (92 loc) · 3.57 KB
/
schema.prisma
File metadata and controls
106 lines (92 loc) · 3.57 KB
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
98
99
100
101
102
103
104
105
106
// 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")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
engineType = "binary"
}
model User {
id String @id @default(cuid())
name String @default("")
email String @unique @default("")
password String?
cart CartItem[] @relation("CartItem_user")
orders Order[] @relation("Order_user")
role Role? @relation("User_role", fields: [roleId], references: [id])
roleId String? @map("role")
passwordResetToken String?
passwordResetIssuedAt DateTime?
passwordResetRedeemedAt DateTime?
@@index([roleId])
}
model Product {
id String @id @default(cuid())
productType String @default("instrument")
name String @default("")
make String @default("")
model String @default("")
category String
instrumentType String?
instrumentKey String @default("")
boreSize Float?
bellSize Float?
description String @default("")
photos ProductImage[] @relation("ProductImage_product")
price Int
status String @default("IN-STOCK")
from_CartItem_product CartItem[] @relation("CartItem_product")
}
model ProductImage {
id String @id @default(cuid())
image Json?
altText String @default("")
product Product? @relation("ProductImage_product", fields: [productId], references: [id])
productId String? @map("product")
from_OrderItem_photos OrderItem[] @relation("OrderItem_photos_many")
@@index([productId])
}
model CartItem {
id String @id @default(cuid())
quantity Int @default(1)
product Product? @relation("CartItem_product", fields: [productId], references: [id])
productId String? @map("product")
user User? @relation("CartItem_user", fields: [userId], references: [id])
userId String? @map("user")
@@index([productId])
@@index([userId])
}
model OrderItem {
id String @id @default(cuid())
name String @default("")
description String @default("")
photos ProductImage[] @relation("OrderItem_photos_many")
price Int?
quantity Int?
order Order? @relation("OrderItem_order", fields: [orderId], references: [id])
orderId String? @map("order")
@@index([orderId])
}
model Order {
id String @id @default(cuid())
total Int?
items OrderItem[] @relation("OrderItem_order")
user User? @relation("Order_user", fields: [userId], references: [id])
userId String? @map("user")
charge String @default("")
@@index([userId])
}
model Role {
id String @id @default(cuid())
name String @default("")
canManageProducts Boolean @default(false)
canSeeOtherUsers Boolean @default(false)
canManageUsers Boolean @default(false)
canManageRoles Boolean @default(false)
canManageCart Boolean @default(false)
canManageOrders Boolean @default(false)
assignedTo User[] @relation("User_role")
}