-
Notifications
You must be signed in to change notification settings - Fork 1
/
seed.db.sql
82 lines (68 loc) · 2.71 KB
/
seed.db.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
74
75
76
77
78
79
80
81
82
-- The Frequencies table contains information about the frequency of trips. It includes the trip ID,
-- start time, end time, and headway in seconds. This table helps in determining the frequency of trips
-- on a specific route during different time intervals.
CREATE TABLE frequencies (
trip_id TEXT,
start_time TEXT,
end_time TEXT,
headway_secs INTEGER,
location GEOMETRY(Point, 4326)
);
-- The Routes table stores information about the transit routes. It includes the route ID, agency ID,
-- route short name, route long name, and route type. This table represents the different routes available
-- in the transit system, such as bus lines or train lines.
CREATE TABLE routes (
route_id TEXT,
agency_id TEXT,
route_short_name TEXT,
route_long_name TEXT,
route_type INTEGER,
location GEOMETRY(Point, 4326)
);
-- The Shapes table represents the shapes of the transit routes. It includes the shape ID, latitude, longitude,
-- and shape point sequence. This table is used to define the path or geometry of each route,
-- allowing the visualization of the route on a map.
CREATE TABLE shapes (
shape_id TEXT,
shape_pt_lat NUMERIC,
shape_pt_lon NUMERIC,
shape_pt_sequence INTEGER,
location GEOMETRY(Point, 4326)
);
-- The Stops table contains information about the transit stops. It includes the stop ID, stop name,
-- latitude, longitude, location type, and parent station. This table represents the physical locations
-- where passengers can board or alight from transit vehicles.
-- It provides the necessary data to map and visualize the transit stops.
CREATE TABLE stops (
stop_id TEXT,
stop_name TEXT,
stop_lat NUMERIC,
stop_lon NUMERIC,
location_type INTEGER,
parent_station TEXT,
location GEOMETRY(Point, 4326)
);
-- The Stop Times table stores information about the scheduled arrival and departure times at each stop
-- for a specific trip. It includes the trip ID, arrival time, departure time, stop ID, and stop sequence.
-- This table helps in determining the sequence and timing of stops along a trip.
CREATE TABLE stop_times (
trip_id TEXT,
arrival_time TEXT,
departure_time TEXT,
stop_id TEXT,
stop_sequence INTEGER,
location GEOMETRY(Point, 4326)
);
-- The Trips table contains information about individual trips within a route.
-- It includes the route ID, service ID, trip ID, trip headsign, direction ID, and shape ID.
-- This table represents the specific trips that vehicles make along a route, with details such as
-- the trip headsign (destination) and the associated shape (geometry) of the trip.
CREATE TABLE trips (
route_id TEXT,
service_id TEXT,
trip_id TEXT,
trip_headsign TEXT,
direction_id INTEGER,
shape_id TEXT,
location GEOMETRY(Point, 4326)
);