diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-28 22:33:09 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-28 22:33:09 +0200 |
commit | fd6d12d355e5fb5596168b91affe71eb059c0e99 (patch) | |
tree | bc984831db2c7d3a1bb2d55fb2cbd231c708029d /lib/Travelynx/Command/database.pm | |
parent | cc1a620041ec946ae130055c56f0d35c760c7468 (diff) |
Handle inconsistent data when calculating monthly/yearly stats
Closes #11
Diffstat (limited to 'lib/Travelynx/Command/database.pm')
-rw-r--r-- | lib/Travelynx/Command/database.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index b5e8cf5..bd22512 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -330,6 +330,19 @@ my @migrations = ( } $db->update( 'schema_version', { version => 4 } ); }, + + # v4 -> v5 + # Handle inconsistent data (overlapping journeys) in statistics. Introduces + # the "inconsistencies" stats key -> rebuild all stats. + sub { + my ($db) = @_; + $db->query( + qq{ + truncate journey_stats; + update schema_version set version = 5; + } + ); + }, ); sub setup_db { |