about summary refs log tree commit diff
path: root/kittybox-rs/migrations
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-01 20:32:42 +0300
committerVika <vika@fireburn.ru>2023-07-09 01:42:47 +0300
commita23a0438847a8ae8409edf6445ea4f43990e249c (patch)
tree21963480c48c450acbc74f357f07cda09d1d15ff /kittybox-rs/migrations
parentfacd6f3bf34b5a1142363dc21d8270985020815d (diff)
downloadkittybox-a23a0438847a8ae8409edf6445ea4f43990e249c.tar.zst
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.
Diffstat (limited to 'kittybox-rs/migrations')
-rw-r--r--kittybox-rs/migrations/0002_webmention_queue.sql10
1 files changed, 10 insertions, 0 deletions
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;