From 6ca55f83b12e01b0f465ba53e16da74b44600cab Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Tue, 22 Aug 2023 09:10:54 +0200 Subject: [PATCH] Database: create index on real_departure to speed up latest journey queries --- lib/Travelynx/Command/database.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index e875a27..c6880d0 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -1903,9 +1903,19 @@ my @migrations = ( } ); }, -); -# TODO add 'hafas' column to in_transit (and maybe journeys? undo/redo needs something to work with...) + # v48 -> v49 + # create indexes for common queries + sub { + my ($db) = @_; + $db->query( + qq{ + create index uid_real_departure_idx on journeys (user_id, real_departure); + update schema_version set version = 49; + } + ); + }, +); sub sync_stations { my ( $db, $iris_version ) = @_;