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

database: v72 upgrade requires manual intervention

parent ec0a5a1a
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -19,6 +19,45 @@ has description => 'Initialize or upgrade database layout';

has usage => sub { shift->extract_usage };

my $v72_migration_fyi = <<'EOF';

      /\
     /  \
    / !! \
   /  !!  \    MANUAL ACTION REQUIRED
  /   !!   \
 /          \
/     !!     \
+------------+

Travlynx 2.21 (or more specifically, database schema v72) persists per-journey
distance data in the database rather than computing it on-the-fly, as the
latter is quite expensive and could cause long load times on the history pages.

Adding this data for all journeys stored so far would take minutes to hours
depending on database size, and is therefore not done as part of this
migration. Please run the following command at your earliest convenience:

$ carton exec perl index.pl stats compute-distances

(adjust "carton exec" prefix, "sudo -u ...", environment variables, etc.
as necessary for your setup -- use the same invocation as for, e.g.,
"perl index.pl maintenance")

The command can operate while the travelynx services are running. Until this
post-migration script has completed, users may be confronted with invalid or
missing distance data in their history view for the current year and month.

There is a short window in which such invalid distances may be cached -- this
will happen whenever a user completes a journey and then opens the history page
for the current year or the current month. If you want to ensure that all
cached data is valid, you can follow up with the follow two commands:

$ carton exec perl index.pl stats purge
$ carton exec perl index.pl stats refresh-all

EOF

sub get_schema_version {
	my ( $db, $key ) = @_;
	my $version;
@@ -3729,6 +3768,7 @@ qq{select distinct checkout_station_id from in_transit where backend_id = 0;}
				update schema_version set version = 72;
			}
		);
		print $v72_migration_fyi;
	},
);