forked from joschan21/casecobra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
104 lines (90 loc) · 2.05 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
98
99
100
101
102
103
104
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum OrderStatus {
fulfilled
shipped
awaiting_shipment
}
enum PhoneModel {
iphonex
iphone11
iphone12
iphone13
iphone14
iphone15
}
enum CaseMaterial {
silicone
polycarbonate
}
enum CaseFinish {
smooth
textured
}
enum CaseColor {
black
blue
rose
}
model Configuration {
id String @id @default(cuid())
width Int
height Int
imageUrl String
color CaseColor?
model PhoneModel?
material CaseMaterial?
finish CaseFinish?
croppedImageUrl String?
Order Order[]
}
model User {
id String @id @default(cuid())
email String
Order Order[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Order {
id String @id @default(cuid())
configurationId String
configuration Configuration @relation(fields: [configurationId], references: [id])
user User @relation(fields: [userId], references: [id])
userId String
amount Float
isPaid Boolean @default(false)
status OrderStatus @default(awaiting_shipment)
shippingAddress ShippingAddress? @relation(fields: [shippingAddressId], references: [id])
shippingAddressId String?
billingAddress BillingAddress? @relation(fields: [billingAddressId], references: [id])
billingAddressId String?
createdAt DateTime @default(now())
updated DateTime @updatedAt
}
model ShippingAddress {
id String @id @default(cuid())
name String
street String
city String
postalCode String
country String
state String?
phoneNumber String?
orders Order[]
}
model BillingAddress {
id String @id @default(cuid())
name String
street String
city String
postalCode String
country String
state String?
phoneNumber String?
orders Order[]
}