-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.sql
More file actions
66 lines (58 loc) · 1.26 KB
/
Copy pathcreate.sql
File metadata and controls
66 lines (58 loc) · 1.26 KB
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
/*
To run this file, use the following command in the console
psql -d app (or database name) -f ../../create.sql (or relative path to create.sql file)
psql -d app -f ../../create.sql
*/
drop schema cccat14 cascade;
create schema cccat14;
create table cccat14.account (
account_id uuid primary key,
name text not null,
email text not null,
cpf text not null,
car_plate text null,
is_passenger boolean not null default false,
is_driver boolean not null default false
);
create table cccat14.ride (
ride_id uuid primary key,
passenger_id uuid,
driver_id uuid,
fare numeric,
distance numeric,
status text,
from_lat numeric,
from_long numeric,
to_lat numeric,
to_long numeric,
last_lat numeric,
last_long numeric,
date timestamp
)
create table cccat14.position (
position_id uuid primary key,
ride_id uuid,
lat numeric,
long numeric,
date timestamp
)
create table cccat14.transaction (
transaction_id uuid primary key,
ride_id uuid,
amount numeric,
date timestamp,
status text
)
create table cccat14.ride_projection (
ride_id uuid,
passenger_id uuid,
driver_id uuid,
fare numeric,
distance numeric,
status text,
passenger_name text null,
passenger_cpf text null,
driver_name text null,
driver_cpf text null,
driver_car_plate text null
);