From b36ba45aef6ce3a62079064a900915a9e222acde Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 5 May 2019 18:09:11 +0200 Subject: WiP webhook support --- lib/Travelynx/Command/database.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/Travelynx/Command/database.pm') diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index 79ff086..11a946e 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -456,6 +456,31 @@ my @migrations = ( } ); }, + + # v10 -> v11 + sub { + my ($db) = @_; + $db->query( + qq{ + create table webhooks ( + user_id integer not null references users (id) primary key, + enabled boolean not null, + url varchar(1000) not null, + token varchar(250), + errored boolean, + latest_run timestamptz, + output text + ); + comment on table webhooks is 'URLs and bearer tokens for push events'; + create view webhooks_str as select + user_id, enabled, url, token, errored, output, + extract(epoch from latest_run) as latest_run_ts + from webhooks + ; + update schema_version set version = 11; + } + ); + }, ); sub setup_db { -- cgit v1.2.3