omnivore/packages/db/migrations/0083.do.webhooks.sql

24 lines
735 B
MySQL
Raw Normal View History

2022-05-25 12:46:19 +00:00
-- Type: DO
-- Name: webhooks
-- Description: webhooks model
BEGIN;
CREATE TABLE omnivore.webhooks (
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
user_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
2022-05-25 12:46:19 +00:00
url text NOT NULL,
method text NOT NULL DEFAULT 'POST',
content_type text NOT NULL DEFAULT 'application/json',
2022-05-25 13:21:17 +00:00
enabled boolean NOT NULL DEFAULT true,
2022-05-25 12:46:19 +00:00
event_types text[] NOT NULL,
created_at timestamptz NOT NULL DEFAULT current_timestamp,
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
UNIQUE (user_id, event_types)
2022-05-25 12:46:19 +00:00
);
CREATE TRIGGER update_webhook_modtime BEFORE UPDATE ON omnivore.webhooks
FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
COMMIT;