summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Command/database.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-05 18:09:11 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-05 18:09:11 +0200
commitb36ba45aef6ce3a62079064a900915a9e222acde (patch)
tree600467fbed7d3bfae6050fdbff90130a8dbf8385 /lib/Travelynx/Command/database.pm
parent55581d1f257eeff7e509cb03f3eeed7e2da6f3a9 (diff)
WiP webhook support
Diffstat (limited to 'lib/Travelynx/Command/database.pm')
-rw-r--r--lib/Travelynx/Command/database.pm25
1 files changed, 25 insertions, 0 deletions
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 {