]> ruin.nu Git - ndwebbie.git/blobdiff - database/functions/calls.sql
Clean up database directory
[ndwebbie.git] / database / functions / calls.sql
diff --git a/database/functions/calls.sql b/database/functions/calls.sql
new file mode 100644 (file)
index 0000000..69821be
--- /dev/null
@@ -0,0 +1,12 @@
+CREATE OR REPLACE FUNCTION add_call() RETURNS trigger
+       AS $_X$
+DECLARE
+       thread INTEGER;
+BEGIN
+       INSERT INTO forum_threads (fbid,subject,uid)
+               VALUES(-3,NEW.uid || ': ' || NEW.landing_tick,-3) RETURNING ftid
+               INTO STRICT thread;
+       NEW.ftid = thread;
+       RETURN NEW;
+END;
+$_X$ LANGUAGE plpgsql;