mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add unique constraint on user_id and event_types
This commit is contained in:
parent
aaab02c9d8
commit
a655275754
2 changed files with 4 additions and 1 deletions
|
|
@ -1614,6 +1614,7 @@ const schema = gql`
|
|||
enum CreateWebhookErrorCode {
|
||||
UNAUTHORIZED
|
||||
BAD_REQUEST
|
||||
ALREADY_EXISTS
|
||||
}
|
||||
|
||||
# Mutations
|
||||
|
|
|
|||
|
|
@ -6,13 +6,15 @@ BEGIN;
|
|||
|
||||
CREATE TABLE omnivore.webhooks (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
|
||||
user_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
|
||||
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
|
||||
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
UNIQUE (user_id, event_types)
|
||||
);
|
||||
|
||||
CREATE TRIGGER update_webhook_modtime BEFORE UPDATE ON omnivore.webhooks
|
||||
|
|
|
|||
Loading…
Reference in a new issue