Unverified Commit 7e9f6bdf authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

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

parent 1bb348ad
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -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 {
+3 −2
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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 {