From 556c839dc1b5881c1594dbdfede0bd610790967d Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Tue, 11 Jun 2024 10:13:13 -0400 Subject: added a shell.nix for pgformatter, and a wip trigger for db size maintenance --- scripts/entry_limit_trigger.pgsql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/entry_limit_trigger.pgsql (limited to 'scripts') diff --git a/scripts/entry_limit_trigger.pgsql b/scripts/entry_limit_trigger.pgsql new file mode 100644 index 0000000..d7d99c2 --- /dev/null +++ b/scripts/entry_limit_trigger.pgsql @@ -0,0 +1,19 @@ +CREATE OR REPLACE FUNCTION milla.janitor () + RETURNS TRIGGER + AS $$ +BEGIN + UPDATE + posts + SET + updated_at = now() + WHERE + id = NEW.id; + RETURN new; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER janitor_trigger + AFTER INSERT ON milla.tables + EXECUTE PROCEDURE milla.janitor (); + -- cgit v1.2.3