lib/gtfs/realtime/database.rb in gtfs-realtime-0.2.3 vs lib/gtfs/realtime/database.rb in gtfs-realtime-0.3.0
- old
+ new
@@ -12,16 +12,14 @@
# the parent project if desired.
db = Sequel.connect(new_path || "sqlite://")
# Set up all database tables
db.create_table? :gtfs_realtime_calendar_dates do
- Integer :id, primary_key: true
String :service_id
Date :date
Integer :exception_type
- index :id
index :service_id
end
db.create_table? :gtfs_realtime_routes do
String :id, primary_key: true
@@ -33,21 +31,21 @@
end
db.create_table? :gtfs_realtime_shapes do
String :id
Integer :sequence
- Double :latitude
- Double :longitude
+ Float :latitude
+ Float :longitude
index :id
end
db.create_table? :gtfs_realtime_stops do
String :id, primary_key: true
String :name
- Double :latitude
- Double :longitude
+ Float :latitude
+ Float :longitude
index :id
end
db.create_table? :gtfs_realtime_stop_times do
@@ -94,13 +92,13 @@
end
db.create_table? :gtfs_realtime_vehicle_positions do
String :trip_id
String :stop_id
- Double :latitude
- Double :longitude
- Double :bearing
+ Float :latitude
+ Float :longitude
+ Float :bearing
Time :timestamp
index :trip_id
index :stop_id
end
@@ -127,17 +125,13 @@
end
end
end
end
-# If we have not defined our model parent class yet, initialize it. Before we can
-# load any other model files, we must have some sort of database set up, so we
-# use an in-memory database for now. Later on, we can change this if we wish by
-# setting `database_path` in a `GTFS::Realtime.configure` block.
+# If we have not defined our model parent class yet, initialize it.
if !defined?(GTFS::Realtime::Model)
GTFS::Realtime::Model = Class.new(Sequel::Model)
GTFS::Realtime::Model.plugin :many_through_many
- GTFS::Realtime::Database.path = nil
class GTFS::Realtime::Model
def self.implicit_table_name
"gtfs_realtime_#{super}".to_sym
end
\ No newline at end of file