mirror of
https://github.com/derf/travelynx
synced 2024-11-29 07:50:20 +00:00
dumpstops: provide backend name and type rather than just opaque IDs
This commit is contained in:
parent
1bb348ad9a
commit
7e9f6bdf90
3 changed files with 26 additions and 3 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue