diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travelynx/Command/database.pm | 22 | ||||
-rw-r--r-- | lib/Travelynx/Command/dumpstops.pm | 5 | ||||
-rw-r--r-- | lib/Travelynx/Model/Stations.pm | 2 |
3 files changed, 26 insertions, 3 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index f2b79f3..4389430 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -2600,6 +2600,28 @@ qq{select distinct checkout_station_id from in_transit where backend_id = 0;} say 'If the migration fails due to a deadlock, re-run it after stopping all background workers'; }, + + # v55 -> v56 + # include backend data in dumpstops command + sub { + my ($db) = @_; + $db->query( + qq{ + create view stations_str as + select stations.name as name, + eva, lat, lon, + backends.name as backend, + iris as is_iris, + hafas as is_hafas, + efa as is_efa, + ris as is_ris + from stations + left join backends + on source = backends.id; + update schema_version set version = 56; + } + ); + }, ); sub sync_stations { diff --git a/lib/Travelynx/Command/dumpstops.pm b/lib/Travelynx/Command/dumpstops.pm index c8ecd7a..4d20bbd 100644 --- a/lib/Travelynx/Command/dumpstops.pm +++ b/lib/Travelynx/Command/dumpstops.pm @@ -24,12 +24,13 @@ sub run { or die("open($filename): $!\n"); my $csv = Text::CSV->new( { eol => "\r\n" } ); - $csv->combine(qw(name eva lat lon source archived)); + $csv->combine(qw(name eva lat lon backend is_iris is_hafas)); print $fh $csv->string; my $iter = $self->app->stations->get_db_iterator; while ( my $row = $iter->hash ) { - $csv->combine( @{$row}{qw{name eva lat lon source archived}} ); + $csv->combine( + @{$row}{qw{name eva lat lon backend is_iris is_hafas}} ); print $fh $csv->string; } close($fh); diff --git a/lib/Travelynx/Model/Stations.pm b/lib/Travelynx/Model/Stations.pm index 7215aa5..76fd452 100644 --- a/lib/Travelynx/Model/Stations.pm +++ b/lib/Travelynx/Model/Stations.pm @@ -164,7 +164,7 @@ sub add_meta { sub get_db_iterator { my ($self) = @_; - return $self->{pg}->db->select( 'stations', '*' ); + return $self->{pg}->db->select( 'stations_str', '*' ); } sub get_meta { |