summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-08-07 12:13:15 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-08-07 12:13:15 +0200
commit7e9f6bdf90605d43f10bfe82a2611f9436546be7 (patch)
treea586d46a008453c7c13d10f3fcdea8fbbb6c939d /lib/Travelynx
parent1bb348ad9a62884309373a5249165478fd13a627 (diff)
dumpstops: provide backend name and type rather than just opaque IDs2.8.10
Diffstat (limited to 'lib/Travelynx')
-rw-r--r--lib/Travelynx/Command/database.pm22
-rw-r--r--lib/Travelynx/Command/dumpstops.pm5
-rw-r--r--lib/Travelynx/Model/Stations.pm2
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 {