diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-09 18:37:21 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-09 18:37:21 +0200 |
commit | bba6721754711446268445044406d74dda01aafc (patch) | |
tree | 5153c2e71abf3f3acd47fcfe5fb69ba4dd8b31f7 /lib/Travelynx/Command | |
parent | 3ae6bda093d67069ca10cdcc777e27b3b09191b7 (diff) |
Allow journey editing, keep track of edited journey attributes0.13
Provides a workaround for #2
Diffstat (limited to 'lib/Travelynx/Command')
-rw-r--r-- | lib/Travelynx/Command/database.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index 4175d58..352c890 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -46,6 +46,7 @@ sub initialize_db { action_id smallint not null, station_id int references stations (id), action_time timestamptz not null, + edited not null, train_type varchar(16), train_line varchar(16), train_no varchar(16), @@ -66,7 +67,7 @@ sub initialize_db { token varchar(80) not null, primary key (user_id, type) ); - insert into schema_version values (0); + insert into schema_version values (2); } ); } @@ -92,6 +93,19 @@ my @migrations = ( } ); }, + + # v1 -> v2 + sub { + my ($dbh) = @_; + return $dbh->do( + qq{ + update user_actions set edited = 0; + alter table user_actions + alter column edited set not null; + update schema_version set version = 2; + } + ); + }, ); sub run { |