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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/gtfs/realtime/database.rb', line 7
def path=(new_path)
@path = new_path
db = Sequel.connect(new_path || "sqlite://")
db.create_table? :gtfs_realtime_routes do
String :id, primary_key: true
String :short_name
String :long_name
String :url
index :id
end
db.create_table? :gtfs_realtime_shapes do
String :id
Integer :sequence
Double :latitude
Double :longitude
index :id
end
db.create_table? :gtfs_realtime_stops do
String :id, primary_key: true
String :name
Double :latitude
Double :longitude
index :id
end
db.create_table? :gtfs_realtime_stop_times do
String :trip_id
String :stop_id
String :arrival_time
String :departure_time
Integer :stop_sequence
index :trip_id
index :stop_id
end
db.create_table? :gtfs_realtime_trips do
String :id, primary_key: true
String :headsign
String :route_id
String :service_id
String :shape_id
index :id
index :route_id
end
db.create_table? :gtfs_realtime_trip_updates do
String :id, primary_key: true
String :trip_id
String :route_id
index :id
end
db.create_table? :gtfs_realtime_stop_time_updates do
String :trip_update_id
String :stop_id
Integer :arrival_delay
Time :arrival_time
Integer :departure_delay
Time :departure_time
index :trip_update_id
index :stop_id
end
db.create_table? :gtfs_realtime_vehicle_positions do
String :trip_id
String :stop_id
Double :latitude
Double :longitude
Double :bearing
Time :timestamp
index :trip_id
index :stop_id
end
db.create_table? :gtfs_realtime_service_alerts do
String :stop_id
String :header_text
Text :description_text
Time :start_time
Time :end_time
index :stop_id
end
model_classes.each do |model_class|
model_class.db = db
end
end
|