From 49f7cacb3a3270219f33b16ccd8665f6996b22d6 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Mar 28 2015 08:47:54 +0000 Subject: Add info on askbot sessions clean trigger Signed-off-by: Patrick Uiterwijk --- diff --git a/askbot.txt b/askbot.txt index ab0532e..ad3713a 100644 --- a/askbot.txt +++ b/askbot.txt @@ -14,7 +14,8 @@ Ask Fedora SOP * 3 Setting up the forum * 4 Adding administrators * 5 Change settings within the forum - * 6 Debugging + * 6 Database tweaks + * 7 Debugging Contact Information @@ -253,6 +254,39 @@ background: -moz-linear-gradient(top, #DDDDDD, #FFFFFF); } +Database tweaks + + To automatically delete expired sessions, we run a trigger + that makes PostgreSQL delete them upon inserting a new one. + + The code used to create this trigger was: +askfedora=# CREATE FUNCTION delete_old_sessions() RETURNS trigger +askfedora-# LANGUAGE plpgsql +askfedora-# AS $$ +askfedora$# BEGIN +askfedora$# DELETE FROM django_session WHERE expire_date