about summary refs log blame commit diff
path: root/kittybox-rs/migrations/0002_webmention_queue.sql
blob: 708933b309448973e0eff34c3fdd54298d4b36cc (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                 

                                                     
                                                         
  
                                                                                          
                                         
                                               
                                   
CREATE TABLE kittybox.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.incoming_webmention_queue (attempts);

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