From a23a0438847a8ae8409edf6445ea4f43990e249c Mon Sep 17 00:00:00 2001
From: Vika <vika@fireburn.ru>
Date: Sat, 1 Jul 2023 20:32:42 +0300
Subject: Create a job queue based on Postgres

It's generic enough to be used for anything, but for now it's only
gonna be used for webmentions.
---
 kittybox-rs/migrations/0002_webmention_queue.sql | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 kittybox-rs/migrations/0002_webmention_queue.sql

(limited to 'kittybox-rs/migrations/0002_webmention_queue.sql')

diff --git a/kittybox-rs/migrations/0002_webmention_queue.sql b/kittybox-rs/migrations/0002_webmention_queue.sql
new file mode 100644
index 0000000..0b95771
--- /dev/null
+++ b/kittybox-rs/migrations/0002_webmention_queue.sql
@@ -0,0 +1,10 @@
+CREATE TABLE 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()
+);
+
+CREATE RULE notify_incoming_webmention AS
+ON INSERT TO incoming_webmention_queue
+DO ALSO NOTIFY incoming_webmention;
-- 
cgit 1.4.1

