Add webhooks model

This commit is contained in:
Hongbo Wu 2022-05-25 20:46:19 +08:00
parent 9a9fb94cf4
commit fe09487a6a
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,21 @@
-- Type: DO
-- Name: webhooks
-- Description: webhooks model
BEGIN;
CREATE TABLE omnivore.webhooks (
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
url text NOT NULL,
method text NOT NULL DEFAULT 'POST',
content_type text NOT NULL DEFAULT 'application/json',
active boolean NOT NULL DEFAULT true,
event_types text[] NOT NULL,
created_at timestamptz NOT NULL DEFAULT current_timestamp,
updated_at timestamptz NOT NULL DEFAULT current_timestamp
);
CREATE TRIGGER update_webhook_modtime BEFORE UPDATE ON omnivore.webhooks
FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
COMMIT;

View file

@ -0,0 +1,9 @@
-- Type: UNDO
-- Name: webhooks
-- Description: webhooks model
BEGIN;
DROP TABLE IF EXISTS omnivore.webhooks;
COMMIT;