diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-08 19:53:37 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-08 19:53:37 +0200 | 
| commit | db7e5faaf49e32edcef28e271e0016c82ea0f7ca (patch) | |
| tree | 0fc92f48955860d3b1aad8327f60f058cb543eca /lib/Travelynx | |
| parent | a08a4be89ecab9fe40d1711f7994f8fa40a8e2f0 (diff) | |
sort timeline (descending by checkin timestamp, so most recent checkins first)1.34.2
Diffstat (limited to 'lib/Travelynx')
| -rw-r--r-- | lib/Travelynx/Command/database.pm | 47 | 
1 files changed, 47 insertions, 0 deletions
| diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index b45a02f..19a4b57 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -1834,6 +1834,53 @@ my @migrations = (  			}  		);  	}, + +	# v46 -> v47 +	# sort followee checkins by checkin time +	# (descending / most recent first, like a timeline) +	sub { +		my ($db) = @_; +		$db->query( +			qq{ +				drop view follows_in_transit; +				create view follows_in_transit as select +					r1.subject_id as follower_id, user_id as followee_id, +					users.name as followee_name, +					train_type, train_line, train_no, train_id, +					extract(epoch from checkin_time) as checkin_ts, +					extract(epoch from sched_departure) as sched_dep_ts, +					extract(epoch from real_departure) as real_dep_ts, +					checkin_station_id as dep_eva, +					dep_station.ds100 as dep_ds100, +					dep_station.name as dep_name, +					dep_station.lat as dep_lat, +					dep_station.lon as dep_lon, +					extract(epoch from checkout_time) as checkout_ts, +					extract(epoch from sched_arrival) as sched_arr_ts, +					extract(epoch from real_arrival) as real_arr_ts, +					checkout_station_id as arr_eva, +					arr_station.ds100 as arr_ds100, +					arr_station.name as arr_name, +					arr_station.lat as arr_lat, +					arr_station.lon as arr_lon, +					polyline_id, +					polylines.polyline as polyline, +					visibility, +					coalesce(visibility, users.public_level & 127) as effective_visibility, +					cancelled, route, messages, user_data, +					dep_platform, arr_platform, data +					from in_transit +					left join polylines on polylines.id = polyline_id +					left join users on users.id = user_id +					left join relations as r1 on r1.predicate = 1 and r1.object_id = user_id +					left join stations as dep_station on checkin_station_id = dep_station.eva +					left join stations as arr_station on checkout_station_id = arr_station.eva +					order by checkin_time desc +					; +				update schema_version set version = 47; +		} +		); +	},  );  # TODO add 'hafas' column to in_transit (and maybe journeys? undo/redo needs something to work with...) | 
