-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
45 lines (41 loc) · 1 KB
/
schema.sql
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
CREATE TABLE watches (
id SERIAL PRIMARY KEY,
brand TEXT,
model TEXT,
price INTEGER,
description TEXT
);
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username TEXT UNIQUE,
password TEXT,
privileges TEXT
);
CREATE TABLE reviews (
id SERIAL PRIMARY KEY,
watch_id INTEGER REFERENCES watches ON DELETE CASCADE,
user_id INTEGER REFERENCES users ON DELETE CASCADE,
review TEXT,
rating INTEGER,
review_date DATE
);
CREATE TABLE cart (
id SERIAL PRIMARY KEY,
watch_id INTEGER REFERENCES watches ON DELETE CASCADE,
user_id INTEGER REFERENCES users ON DELETE CASCADE,
quantity INTEGER
);
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users ON DELETE CASCADE,
watch_id INTEGER REFERENCES watches ON DELETE CASCADE,
first_name TEXT,
last_name TEXT,
shipping_address TEXT,
billing_address TEXT,
phone_number TEXT,
email TEXT,
quantity INTEGER,
payment_method TEXT,
order_date DATE
);