about summary refs log tree commit diff
path: root/migrations/webmention/0001_init.sql
blob: 9e7a1925600e161772dd0bed3517d9361af0dc16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CREATE SCHEMA IF NOT EXISTS kittybox_webmention;

CREATE TABLE kittybox_webmention.incoming_webmention_queue (
       id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
       source TEXT NOT NULL,
       target TEXT NOT NULL,
       recv_timestamp TIMESTAMPTZ NOT NULL DEFAULT now(),
       attempts INTEGER NOT NULL DEFAULT 0
);

CREATE INDEX webmention_jobs_by_attempts ON kittybox_webmention.incoming_webmention_queue (attempts);

CREATE RULE notify_incoming_webmention AS
ON INSERT TO kittybox_webmention.incoming_webmention_queue
DO ALSO NOTIFY incoming_webmention;