dumpstops: provide backend name and type rather than just opaque IDs

This commit is contained in:
Birte Kristina Friesel 2024-08-07 12:13:15 +02:00
parent 1bb348ad9a
commit 7e9f6bdf90
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
3 changed files with 26 additions and 3 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -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 {