From bba6721754711446268445044406d74dda01aafc Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 9 Apr 2019 18:37:21 +0200 Subject: Allow journey editing, keep track of edited journey attributes Provides a workaround for #2 --- lib/Travelynx/Command/database.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/Travelynx/Command') 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 { -- cgit v1.2.3