forked from nromanen/Ch-119.UI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.sql
73 lines (66 loc) · 1.61 KB
/
tables.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
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
create table users (
id BIGSERIAL NOT NULL PRIMARY KEY,
name VARCHAR(50),
trips_num VARCHAR(150),
password VARCHAR(150),
phone_number VARCHAR(50) NOT NULL,
rating DECIMAL(3,2)
);
create table drivers (
id BIGSERIAL NOT NULL PRIMARY KEY,
user_id INT NOT NULL,
FOREIGN KEY (user_id) REFERENCES users (id),
car_color VARCHAR(50) NOT NULL,
car_model VARCHAR(50) NOT NULL,
car_number VARCHAR(50) NOT NULL,
driver_rating DECIMAL(3,2)
);
create table orders (
id BIGSERIAL NOT NULL PRIMARY KEY,
customer_id INT NOT NULL,
FOREIGN KEY (customer_id) REFERENCES users (id),
driver_id INT NOT NULL,
FOREIGN KEY (driver_id) REFERENCES drivers (id),
created_at DATE NOT NULL,
date_of_ride DATE,
last_update DATE,
to VARCHAR(150) NOT NULL,
additional_places ARRAYTEXT,
from VARCHAR(150) NOT NULL,
price VARCHAR(50) NOT NULL,
car_type VARCHAR(7) NOT NULL,
status VARCHAR(10) NOT NULL,
extra_services text,
payment_type text
);
create table feedbacks (
id BIGSERIAL NOT NULL PRIMARY KEY,
text TEXT,
rating DECIMAL,
created_by user_id,
about_who user_id,
created_at DATE NOT NULL
);
create table credit_cards (
id BIGSERIAL NOT NULL PRIMARY KEY,
number BIGINT,
date_of_expiration DATE NOT NULL,
client_id DECIMAL
);
create table favourite_places (
id BIGSERIAL NOT NULL PRIMARY KEY,
title TEXT,
location TEXT,
client_id DECIMAL
);
create table roles (
id BIGSERIAL NOT NULL PRIMARY KEY,
title TEXT
);
create table user_roles (
id BIGSERIAL NOT NULL PRIMARY KEY,
user_id INT NOT NULL,
FOREIGN KEY (user_id) REFERENCES users (id),
roles_id INT NOT NULL,
FOREIGN KEY (roles_id) REFERENCES roles (id)
);