This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.prisma
174 lines (156 loc) · 6.93 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model categories {
category_id Int @id(map: "pk_categories")
category_name String
description String?
picture Bytes?
products products[]
}
model customer_customer_demo {
customer_id String
customer_type_id String
customer_demographics customer_demographics @relation(fields: [customer_type_id], references: [customer_type_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_customer_customer_demo_customer_demographics")
customers customers @relation(fields: [customer_id], references: [customer_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_customer_customer_demo_customers")
@@id([customer_id, customer_type_id], map: "pk_customer_customer_demo")
}
model customer_demographics {
customer_type_id String @id(map: "pk_customer_demographics")
customer_desc String?
customer_customer_demo customer_customer_demo[]
}
model customers {
customer_id String @id(map: "pk_customers")
company_name String
contact_name String?
contact_title String?
address String?
city String?
region String?
postal_code String?
country String?
phone String?
fax String?
customer_customer_demo customer_customer_demo[]
orders orders[]
}
model employee_territories {
employee_id Int
territory_id String
employees employees @relation(fields: [employee_id], references: [employee_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_employee_territories_employees")
territories territories @relation(fields: [territory_id], references: [territory_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_employee_territories_territories")
@@id([employee_id, territory_id], map: "pk_employee_territories")
}
model employees {
employee_id Int @id(map: "pk_employees")
last_name String
first_name String
title String?
title_of_courtesy String?
birth_date DateTime?
hire_date DateTime?
address String?
city String?
region String?
postal_code String?
country String?
home_phone String?
extension String?
photo Bytes?
notes String?
reports_to Int?
photo_path String?
employees employees? @relation("employeesToemployees", fields: [reports_to], references: [employee_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_employees_employees")
employee_territories employee_territories[]
other_employees employees[] @relation("employeesToemployees")
orders orders[]
}
model order_details {
order_id Int
product_id Int
unit_price Float
quantity Int
discount Float
orders orders @relation(fields: [order_id], references: [order_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_order_details_orders")
products products @relation(fields: [product_id], references: [product_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_order_details_products")
@@id([order_id, product_id], map: "pk_order_details")
}
model orders {
order_id Int @id(map: "pk_orders")
customer_id String?
employee_id Int?
order_date DateTime?
required_date DateTime?
shipped_date DateTime?
ship_via Int?
freight Float?
ship_name String?
ship_address String?
ship_city String?
ship_region String?
ship_postal_code String?
ship_country String?
customers customers? @relation(fields: [customer_id], references: [customer_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_orders_customers")
employees employees? @relation(fields: [employee_id], references: [employee_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_orders_employees")
shippers shippers? @relation(fields: [ship_via], references: [shipper_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_orders_shippers")
order_details order_details[]
}
model products {
product_id Int @id(map: "pk_products")
product_name String
supplier_id Int?
category_id Int?
quantity_per_unit String?
unit_price Float?
units_in_stock Int?
units_on_order Int?
reorder_level Int?
discontinued Int
categories categories? @relation(fields: [category_id], references: [category_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_products_categories")
suppliers suppliers? @relation(fields: [supplier_id], references: [supplier_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_products_suppliers")
order_details order_details[]
}
model region {
region_id Int @id(map: "pk_region")
region_description String
territories territories[]
}
model shippers {
shipper_id Int @id(map: "pk_shippers")
company_name String
phone String?
orders orders[]
}
model suppliers {
supplier_id Int @id(map: "pk_suppliers")
company_name String
contact_name String?
contact_title String?
address String?
city String?
region String?
postal_code String?
country String?
phone String?
fax String?
homepage String?
products products[]
}
model territories {
territory_id String @id(map: "pk_territories")
territory_description String
region_id Int
region region @relation(fields: [region_id], references: [region_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_territories_region")
employee_territories employee_territories[]
}
model us_states {
state_id Int @id(map: "pk_usstates")
state_name String?
state_abbr String?
state_region String?
}