-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
34 lines (32 loc) · 897 Bytes
/
Copy pathinit.sql
File metadata and controls
34 lines (32 loc) · 897 Bytes
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
CREATE TABLE clients (
username VARCHAR(32),
user_email VARCHAR(255),
pass VARCHAR(32),
id INT AUTO_INCREMENT PRIMARY KEY
);
CREATE TABLE menu (
item_name VARCHAR(64),
item_type VARCHAR(16),
item_price FLOAT UNSIGNED,
id INT AUTO_INCREMENT PRIMARY KEY
)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE menu_description (
id INT,
PRIMARY KEY (id),
FOREIGN KEY (id) REFERENCES menu(id) ON DELETE CASCADE,
content TEXT,
ingredients TEXT,
image_path VARCHAR(255)
)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE orders (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
user_note VARCHAR(200)
);
CREATE TABLE order_items (
order_id INT,
item_id INT,
quantity INT,
PRIMARY KEY (order_id, item_id),
FOREIGN KEY (order_id) REFERENCES orders(id) -- Linking back to the orders table
);