summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-21 22:14:10 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-21 22:14:10 +0100
commit0243a114b43c9c533a99c7f562c0e57d3a66671f (patch)
treef8e67c6500914bd0e86e41087d9f41f02901aea0
parent21fe8a6990e996a556066e0142ede258df429a5b (diff)
Add migration for monthly stats
-rwxr-xr-xmigrate.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/migrate.pl b/migrate.pl
index d52715c..54cb8ce 100755
--- a/migrate.pl
+++ b/migrate.pl
@@ -195,6 +195,36 @@ my @migrations = (
);
$dbh->commit;
},
+
+ # v3 -> v4
+ sub {
+ $dbh->begin_work;
+ $dbh->do(
+ qq{
+ update schema_version set version = 4;
+ }
+ );
+ $dbh->do(
+ qq{
+ create table monthly_stats (
+ user_id integer not null,
+ year int not null,
+ month int not null,
+ km_route int not null,
+ km_beeline int not null,
+ min_travel_sched int not null,
+ min_travel_real int not null,
+ min_change_sched int not null,
+ min_change_real int not null,
+ num_cancelled int not null,
+ num_trains int not null,
+ num_journeys int not null,
+ primary key (user_id, year, month)
+ );
+ }
+ );
+ $dbh->commit;
+ },
);
my $schema_version = get_schema_version();